• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java HServerLoad类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.hbase.HServerLoad的典型用法代码示例。如果您正苦于以下问题:Java HServerLoad类的具体用法?Java HServerLoad怎么用?Java HServerLoad使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HServerLoad类属于org.apache.hadoop.hbase包,在下文中一共展示了HServerLoad类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: regionServerStartup

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
/**
 * Let the server manager know a new regionserver has come online
 * @param ia The remote address
 * @param port The remote port
 * @param serverStartcode
 * @param serverCurrentTime The current time of the region server in ms
 * @return The ServerName we know this server as.
 * @throws IOException
 */
ServerName regionServerStartup(final InetAddress ia, final int port,
  final long serverStartcode, long serverCurrentTime)
throws IOException {
  // Test for case where we get a region startup message from a regionserver
  // that has been quickly restarted but whose znode expiration handler has
  // not yet run, or from a server whose fail we are currently processing.
  // Test its host+port combo is present in serverAddresstoServerInfo.  If it
  // is, reject the server and trigger its expiration. The next time it comes
  // in, it should have been removed from serverAddressToServerInfo and queued
  // for processing by ProcessServerShutdown.
  ServerName sn = new ServerName(ia.getHostName(), port, serverStartcode);
  checkClockSkew(sn, serverCurrentTime);
  checkIsDead(sn, "STARTUP");
  checkAlreadySameHostPort(sn);
  recordNewServer(sn, HServerLoad.EMPTY_HSERVERLOAD);
  return sn;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:27,代码来源:ServerManager.java


示例2: regionServerReport

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
void regionServerReport(ServerName sn, HServerLoad hsl)
throws YouAreDeadException, PleaseHoldException {
  checkIsDead(sn, "REPORT");
  if (!this.onlineServers.containsKey(sn)) {
    // Already have this host+port combo and its just different start code?
    checkAlreadySameHostPort(sn);
    // Just let the server in. Presume master joining a running cluster.
    // recordNewServer is what happens at the end of reportServerStartup.
    // The only thing we are skipping is passing back to the regionserver
    // the ServerName to use. Here we presume a master has already done
    // that so we'll press on with whatever it gave us for ServerName.
    recordNewServer(sn, hsl);
  } else {
    this.onlineServers.put(sn, hsl);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:17,代码来源:ServerManager.java


示例3: tryRegionServerReport

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
void tryRegionServerReport() throws IOException {
  if (!keepLooping() && hbaseMaster == null) {
    // the current server is stopping
    return;
  }
  HServerLoad hsl = buildServerLoad();
  // Why we do this?
  this.requestCount.set(0);
  try {
    this.hbaseMaster.regionServerReport(this.serverNameFromMasterPOV.getVersionedBytes(), hsl);
  } catch (IOException ioe) {
    if (ioe instanceof RemoteException) {
      ioe = ((RemoteException) ioe).unwrapRemoteException();
    }
    if (ioe instanceof YouAreDeadException) {
      // This will be caught and handled as a fatal error in run()
      throw ioe;
    }
    // Couldn't connect to the master, get location from zk and reconnect
    // Method blocks until new master is found or we are stopped
    getMaster();
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:24,代码来源:HRegionServer.java


示例4: tryRegionServerReport

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
void tryRegionServerReport()
throws IOException {
  if (!keepLooping() && hbaseMaster == null) {
    // the current server is stopping
    return;
  }
  HServerLoad hsl = buildServerLoad();
  // Why we do this?
  this.requestCount.set(0);
  try {
    this.hbaseMaster.regionServerReport(this.serverNameFromMasterPOV.getVersionedBytes(), hsl);
  } catch (IOException ioe) {
    if (ioe instanceof RemoteException) {
      ioe = ((RemoteException)ioe).unwrapRemoteException();
    }
    if (ioe instanceof YouAreDeadException) {
      // This will be caught and handled as a fatal error in run()
      throw ioe;
    }
    // Couldn't connect to the master, get location from zk and reconnect
    // Method blocks until new master is found or we are stopped
    getMaster();
  }
}
 
开发者ID:wanhao,项目名称:IRIndex,代码行数:25,代码来源:HRegionServer.java


示例5: tryRegionServerReport

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
void tryRegionServerReport()
throws IOException {
  HServerLoad hsl = buildServerLoad();
  // Why we do this?
  this.requestCount.set(0);
  try {
    this.hbaseMaster.regionServerReport(this.serverNameFromMasterPOV.getVersionedBytes(), hsl);
  } catch (IOException ioe) {
    if (ioe instanceof RemoteException) {
      ioe = ((RemoteException)ioe).unwrapRemoteException();
    }
    if (ioe instanceof YouAreDeadException) {
      // This will be caught and handled as a fatal error in run()
      throw ioe;
    }
    // Couldn't connect to the master, get location from zk and reconnect
    // Method blocks until new master is found or we are stopped
    getMaster();
  }
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:21,代码来源:HRegionServer.java


示例6: hrlToARL

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
static public ARegionLoad hrlToARL(HServerLoad.RegionLoad rl) throws IOException {
  ARegionLoad arl = new ARegionLoad();
  arl.memStoreSizeMB = rl.getMemStoreSizeMB();
  arl.name = ByteBuffer.wrap(rl.getName());
  arl.storefileIndexSizeMB = rl.getStorefileIndexSizeMB();
  arl.storefiles = rl.getStorefiles();
  arl.storefileSizeMB = rl.getStorefileSizeMB();
  arl.stores = rl.getStores();
  return arl;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:11,代码来源:AvroUtil.java


示例7: hslToASL

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
static public AServerLoad hslToASL(HServerLoad hsl) throws IOException {
   AServerLoad asl = new AServerLoad();
   asl.load = hsl.getLoad();
   asl.maxHeapMB = hsl.getMaxHeapMB();
   asl.memStoreSizeInMB = hsl.getMemStoreSizeInMB();
   asl.numberOfRegions = hsl.getNumberOfRegions();
   asl.numberOfRequests = hsl.getNumberOfRequests();

   Collection<HServerLoad.RegionLoad> regionLoads = hsl.getRegionsLoad().values();
   Schema s = Schema.createArray(ARegionLoad.SCHEMA$);
   GenericData.Array<ARegionLoad> aregionLoads = null;
   if (regionLoads != null) {
     aregionLoads = new GenericData.Array<ARegionLoad>(regionLoads.size(), s);
     for (HServerLoad.RegionLoad rl : regionLoads) {
aregionLoads.add(hrlToARL(rl));
     }
   } else {
     aregionLoads = new GenericData.Array<ARegionLoad>(0, s);
   }
   asl.regionsLoad = aregionLoads;

   asl.storefileIndexSizeInMB = hsl.getStorefileIndexSizeInMB();
   asl.storefiles = hsl.getStorefiles();
   asl.storefileSizeInMB = hsl.getStorefileSizeInMB();
   asl.usedHeapMB = hsl.getUsedHeapMB();
   return asl;
 }
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:28,代码来源:AvroUtil.java


示例8: hsiToASI

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
static public AServerInfo hsiToASI(ServerName sn, HServerLoad hsl) throws IOException {
  AServerInfo asi = new AServerInfo();
  asi.infoPort = -1;
  asi.load = hslToASL(hsl);
  asi.serverAddress = hsaToASA(new HServerAddress(sn.getHostname(), sn.getPort()));
  asi.serverName = new Utf8(sn.toString());
  asi.startCode = sn.getStartcode();
  return asi;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:10,代码来源:AvroUtil.java


示例9: dumpServers

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
private void dumpServers(HMaster master, PrintWriter out) {
  Map<ServerName, HServerLoad> servers =
    master.getServerManager().getOnlineServers();
  for (Map.Entry<ServerName, HServerLoad> e : servers.entrySet()) {
    out.println(e.getKey() + ": " + e.getValue());
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:8,代码来源:MasterDumpServlet.java


示例10: getLoad

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
/**
 * @param address
 * @return HServerLoad if serverName is known else null
 * @deprecated Use {@link #getLoad(HServerAddress)}
 */
public HServerLoad getLoad(final HServerAddress address) {
  ServerName sn = new ServerName(address.toString(), ServerName.NON_STARTCODE);
  ServerName actual =
    ServerName.findServerWithSameHostnamePort(this.getOnlineServersList(), sn);
  return actual == null? null: getLoad(actual);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:12,代码来源:ServerManager.java


示例11: getAverageLoad

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
/**
 * Compute the average load across all region servers.
 * Currently, this uses a very naive computation - just uses the number of
 * regions being served, ignoring stats about number of requests.
 * @return the average load
 */
public double getAverageLoad() {
  int totalLoad = 0;
  int numServers = 0;
  double averageLoad = 0.0;
  for (HServerLoad hsl: this.onlineServers.values()) {
      numServers++;
      totalLoad += hsl.getNumberOfRegions();
  }
  averageLoad = (double)totalLoad / (double)numServers;
  return averageLoad;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:18,代码来源:ServerManager.java


示例12: getOnlineServers

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
/**
 * @return Read-only map of servers to serverinfo
 */
public Map<ServerName, HServerLoad> getOnlineServers() {
  // Presumption is that iterating the returned Map is OK.
  synchronized (this.onlineServers) {
    return Collections.unmodifiableMap(this.onlineServers);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:10,代码来源:ServerManager.java


示例13: regionServerReport

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
@Override
public void regionServerReport(final byte [] sn, final HServerLoad hsl)
throws IOException {
  this.serverManager.regionServerReport(ServerName.parseVersionedServerName(sn), hsl);
  if (hsl != null && this.metrics != null) {
    // Up our metrics.
    this.metrics.incrementRequests(hsl.getTotalNumberOfRequests());
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:10,代码来源:HMaster.java


示例14: getRegionServers

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
@Override
public Map<String, HServerLoad> getRegionServers() {
  Map<String, HServerLoad> data = new HashMap<String, HServerLoad>();
  for (final Entry<ServerName, HServerLoad> entry :
    master.getServerManager().getOnlineServers().entrySet()) {
    data.put(entry.getKey().getServerName(),
        entry.getValue());
  }
  return data;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:11,代码来源:MXBeanImpl.java


示例15: buildServerLoad

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
HServerLoad buildServerLoad() {
  Collection<HRegion> regions = getOnlineRegionsLocalContext();
  TreeMap<byte[], HServerLoad.RegionLoad> regionLoads =
      new TreeMap<byte[], HServerLoad.RegionLoad>(Bytes.BYTES_COMPARATOR);
  for (HRegion region : regions) {
    regionLoads.put(region.getRegionName(), createRegionLoad(region));
  }
  MemoryUsage memory = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
  return new HServerLoad(requestCount.get(), (int) metrics.getRequests(),
      (int) (memory.getUsed() / 1024 / 1024), (int) (memory.getMax() / 1024 / 1024), regionLoads,
      this.hlog.getCoprocessorHost().getCoprocessors());
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:13,代码来源:HRegionServer.java


示例16: createRegionLoad

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
private HServerLoad.RegionLoad createRegionLoad(final HRegion r) {
  byte[] name = r.getRegionName();
  int stores = 0;
  int storefiles = 0;
  int storeUncompressedSizeMB = 0;
  int storefileSizeMB = 0;
  int memstoreSizeMB = (int) (r.memstoreSize.get() / 1024 / 1024);
  int storefileIndexSizeMB = 0;
  int rootIndexSizeKB = 0;
  int totalStaticIndexSizeKB = 0;
  int totalStaticBloomSizeKB = 0;
  long totalCompactingKVs = 0;
  long currentCompactedKVs = 0;
  synchronized (r.stores) {
    stores += r.stores.size();
    for (Store store : r.stores.values()) {
      storefiles += store.getStorefilesCount();
      storeUncompressedSizeMB += (int) (store.getStoreSizeUncompressed() / 1024 / 1024);
      storefileSizeMB += (int) (store.getStorefilesSize() / 1024 / 1024);
      storefileIndexSizeMB += (int) (store.getStorefilesIndexSize() / 1024 / 1024);
      CompactionProgress progress = store.getCompactionProgress();
      if (progress != null) {
        totalCompactingKVs += progress.totalCompactingKVs;
        currentCompactedKVs += progress.currentCompactedKVs;
      }

      rootIndexSizeKB += (int) (store.getStorefilesIndexSize() / 1024);

      totalStaticIndexSizeKB += (int) (store.getTotalStaticIndexSize() / 1024);

      totalStaticBloomSizeKB += (int) (store.getTotalStaticBloomSize() / 1024);
    }
  }
  return new HServerLoad.RegionLoad(name, stores, storefiles, storeUncompressedSizeMB,
      storefileSizeMB, memstoreSizeMB, storefileIndexSizeMB, rootIndexSizeKB,
      totalStaticIndexSizeKB, totalStaticBloomSizeKB, (int) r.readRequestsCount.get(),
      (int) r.writeRequestsCount.get(), totalCompactingKVs, currentCompactedKVs);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:39,代码来源:HRegionServer.java


示例17: verifyRegionServers

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
private void verifyRegionServers(Map<String, HServerLoad> regions) {
  Set<String> expected = new HashSet<String>();
  for (int i = 0; i < 4; ++i) {
    HRegionServer rs = TEST_UTIL.getMiniHBaseCluster().getRegionServer(i);
    expected.add(rs.getServerName().getServerName());
  }

  int found = 0;
  for (java.util.Map.Entry<String, HServerLoad> entry : regions.entrySet()) {
    if (expected.contains(entry.getKey())) {
      ++found;
    }
  }
  Assert.assertEquals(4, found);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:16,代码来源:TestMXBean.java


示例18: before

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
@Before
public void before() throws ZooKeeperConnectionException, IOException {
  // TODO: Make generic versions of what we do below and put up in a mocking
  // utility class or move up into HBaseTestingUtility.

  // Mock a Server.  Have it return a legit Configuration and ZooKeeperWatcher.
  // If abort is called, be sure to fail the test (don't just swallow it
  // silently as is mockito default).
  this.server = Mockito.mock(Server.class);
  Mockito.when(server.getConfiguration()).thenReturn(HTU.getConfiguration());
  this.watcher =
    new ZooKeeperWatcher(HTU.getConfiguration(), "mockedServer", this.server, true);
  Mockito.when(server.getZooKeeper()).thenReturn(this.watcher);
  Mockito.doThrow(new RuntimeException("Aborted")).
    when(server).abort(Mockito.anyString(), (Throwable)Mockito.anyObject());

  // Mock a ServerManager.  Say server SERVERNAME_{A,B} are online.  Also
  // make it so if close or open, we return 'success'.
  this.serverManager = Mockito.mock(ServerManager.class);
  Mockito.when(this.serverManager.isServerOnline(SERVERNAME_A)).thenReturn(true);
  Mockito.when(this.serverManager.isServerOnline(SERVERNAME_B)).thenReturn(true);
  final Map<ServerName, HServerLoad> onlineServers = new HashMap<ServerName, HServerLoad>();
  onlineServers.put(SERVERNAME_B, new HServerLoad());
  onlineServers.put(SERVERNAME_A, new HServerLoad());
  Mockito.when(this.serverManager.getOnlineServersList()).thenReturn(
      new ArrayList<ServerName>(onlineServers.keySet()));
  Mockito.when(this.serverManager.getOnlineServers()).thenReturn(onlineServers);
  Mockito.when(this.serverManager.sendRegionClose(SERVERNAME_A, REGIONINFO, -1)).
    thenReturn(true);
  Mockito.when(this.serverManager.sendRegionClose(SERVERNAME_B, REGIONINFO, -1)).
    thenReturn(true);
  // Ditto on open.
  Mockito.when(this.serverManager.sendRegionOpen(SERVERNAME_A, REGIONINFO, -1)).
    thenReturn(RegionOpeningState.OPENED);
  Mockito.when(this.serverManager.sendRegionOpen(SERVERNAME_B, REGIONINFO, -1)).
  thenReturn(RegionOpeningState.OPENED);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:38,代码来源:TestAssignmentManager.java


示例19: testDisablingTableRegionsAssignmentDuringCleanClusterStartup

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
/**
 * Test verifies whether assignment is skipped for regions of tables in DISABLING state during
 * clean cluster startup. See HBASE-6281.
 *
 * @throws KeeperException
 * @throws IOException
 * @throws Exception
 */
@Test
public void testDisablingTableRegionsAssignmentDuringCleanClusterStartup()
    throws KeeperException, IOException, Exception {
  this.server.getConfiguration().setClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS,
      MockedLoadBalancer.class, LoadBalancer.class);
  Mockito.when(this.serverManager.getOnlineServers()).thenReturn(
      new HashMap<ServerName, HServerLoad>(0));
  List<ServerName> destServers = new ArrayList<ServerName>(1);
  destServers.add(SERVERNAME_A);
  Mockito.when(this.serverManager.getDrainingServersList()).thenReturn(destServers);
  // To avoid cast exception in DisableTableHandler process.
  //Server server = new HMaster(HTU.getConfiguration());
  AssignmentManagerWithExtrasForTesting am = setUpMockedAssignmentManager(server,
      this.serverManager);
  AtomicBoolean gate = new AtomicBoolean(false);
  if (balancer instanceof MockedLoadBalancer) {
    ((MockedLoadBalancer) balancer).setGateVariable(gate);
  }
  try{
    // set table in disabling state.
    am.getZKTable().setDisablingTable(REGIONINFO.getTableNameAsString());
    am.joinCluster();
    // should not call retainAssignment if we get empty regions in assignAllUserRegions.
    assertFalse(
        "Assign should not be invoked for disabling table regions during clean cluster startup.",
        gate.get());
    // need to change table state from disabling to disabled.
    assertTrue("Table should be disabled.",
        am.getZKTable().isDisabledTable(REGIONINFO.getTableNameAsString()));
  } finally {
    this.server.getConfiguration().setClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS,
      DefaultLoadBalancer.class, LoadBalancer.class);
    am.getZKTable().setEnabledTable(REGIONINFO.getTableNameAsString());
    am.shutdown();
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:45,代码来源:TestAssignmentManager.java


示例20: RegionLoadAdapter

import org.apache.hadoop.hbase.HServerLoad; //导入依赖的package包/类
public RegionLoadAdapter(HBaseAdmin admin, Map<byte[], HRegionInfo> regionMap, Args args) throws IOException {
    long timestamp = System.currentTimeMillis();

    ClusterStatus clusterStatus = admin.getClusterStatus();
    Collection<ServerName> serverNames = clusterStatus.getServers();
    for (ServerName serverName : serverNames) {
        HServerLoad serverLoad = clusterStatus.getLoad(serverName);
        for (Map.Entry<byte[], HServerLoad.RegionLoad> entry : serverLoad.getRegionsLoad().entrySet()) {
            if (regionMap.get(entry.getKey()) != null)
                regionLoadMap.put(regionMap.get(entry.getKey()), new RegionLoadDelegator(entry.getValue()));
        }
    }

    Util.printVerboseMessage(args, "RegionLoadAdapter", timestamp);
}
 
开发者ID:kakao,项目名称:hbase-tools,代码行数:16,代码来源:RegionLoadAdapter.java



注:本文中的org.apache.hadoop.hbase.HServerLoad类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InstrumentationConfiguration类代码示例发布时间:2022-05-22
下一篇:
Java UntrustedIdentityException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap