當前位置: 首頁>>代碼示例>>Java>>正文


Java HBaseAdmin.balancer方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.client.HBaseAdmin.balancer方法的典型用法代碼示例。如果您正苦於以下問題:Java HBaseAdmin.balancer方法的具體用法?Java HBaseAdmin.balancer怎麽用?Java HBaseAdmin.balancer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.client.HBaseAdmin的用法示例。


在下文中一共展示了HBaseAdmin.balancer方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setUpBeforeClass

import org.apache.hadoop.hbase.client.HBaseAdmin; //導入方法依賴的package包/類
/**
 * Spin up a cluster with a bunch of regions on it.
 */
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.startMiniCluster(NB_SLAVES);
  TEST_UTIL.getConfiguration().setBoolean("hbase.master.enabletable.roundrobin", true);
  ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(TEST_UTIL);
  HTableDescriptor htd = new HTableDescriptor(TABLENAME);
  htd.addFamily(new HColumnDescriptor(FAMILY));
  TEST_UTIL.createMultiRegionsInMeta(TEST_UTIL.getConfiguration(), htd,
      HBaseTestingUtility.KEYS);
  // Make a mark for the table in the filesystem.
  FileSystem fs = FileSystem.get(TEST_UTIL.getConfiguration());
  FSTableDescriptors.
    createTableDescriptor(fs, FSUtils.getRootDir(TEST_UTIL.getConfiguration()), htd);
  // Assign out the regions we just created.
  HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
  MiniHBaseCluster cluster = TEST_UTIL.getMiniHBaseCluster();
  admin.disableTable(TABLENAME);
  admin.enableTable(TABLENAME);
  boolean ready = false;
  while (!ready) {
    ZKAssign.blockUntilNoRIT(zkw);
    // Assert that every regionserver has some regions on it, else invoke the balancer.
    ready = true;
    for (int i = 0; i < NB_SLAVES; i++) {
      HRegionServer hrs = cluster.getRegionServer(i);
      if (hrs.getOnlineRegions().isEmpty()) {
        ready = false;
        break;
      }
    }
    if (!ready) {
      admin.balancer();
      Thread.sleep(100);
    }
  }
}
 
開發者ID:fengchen8086,項目名稱:LCIndex-HBase-0.94.16,代碼行數:40,代碼來源:TestDrainingServer.java

示例2: perform

import org.apache.hadoop.hbase.client.HBaseAdmin; //導入方法依賴的package包/類
@Override
public void perform() throws Exception {
  LOG.info("Balancing regions");
  HBaseAdmin admin = this.context.getHBaseIntegrationTestingUtility().getHBaseAdmin();
  boolean result = admin.balancer();
  if (!result) {
    LOG.error("Balancer didn't succeed");
  }
}
 
開發者ID:fengchen8086,項目名稱:LCIndex-HBase-0.94.16,代碼行數:10,代碼來源:ChaosMonkey.java

示例3: forceBalancer

import org.apache.hadoop.hbase.client.HBaseAdmin; //導入方法依賴的package包/類
protected void forceBalancer() throws Exception {
  HBaseAdmin admin = this.context.getHBaseIntegrationTestingUtility().getHBaseAdmin();
  boolean result = admin.balancer();
  if (!result) {
    LOG.error("Balancer didn't succeed");
  }
}
 
開發者ID:tenggyut,項目名稱:HIndex,代碼行數:8,代碼來源:Action.java


注:本文中的org.apache.hadoop.hbase.client.HBaseAdmin.balancer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。