org.apache.hadoop.hbase.client.Admin.balancerSwitch()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中org.apache.hadoop.hbase.client.Admin.balancerSwitch()方法的一些代码示例,展示了Admin.balancerSwitch()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Admin.balancerSwitch()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Admin
类名称:Admin
方法名:balancerSwitch

Admin.balancerSwitch介绍

[英]Turn the load balancer on or off.
[中]打开或关闭负载平衡器。

代码示例

代码示例来源:origin: apache/hbase

/**
 * Turn the load balancer on or off.
 *
 * @param synchronous If <code>true</code>, it waits until current balance() call, if
 * outstanding, to return.
 * @return Previous balancer value
 * @deprecated Since 2.0.0. Will be removed in 3.0.0.
 * Use {@link #balancerSwitch(boolean, boolean)} instead.
 */
@Deprecated
default boolean setBalancerRunning(boolean on, boolean synchronous) throws IOException {
 return balancerSwitch(on, synchronous);
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUpBeforeClass() throws Exception {
 TEST_UTIL.startMiniCluster(3);
 TEST_UTIL.getAdmin().balancerSwitch(false, true);
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUp() throws Exception {
 UTIL.startMiniCluster(3);
 UTIL.getAdmin().balancerSwitch(false, true);
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUpBeforeClass() throws Exception {
 UTIL.getConfiguration().setInt(MasterProcedureConstants.MASTER_PROCEDURE_THREADS, 1);
 UTIL.startMiniCluster(3);
 UTIL.getAdmin().balancerSwitch(false, true);
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUpBeforeClass() throws Exception {
 UTIL.getConfiguration().setInt("replication.source.nb.capacity", 10);
 UTIL.getConfiguration().setLong("replication.sleep.before.failover", 1000);
 UTIL.getConfiguration().setLong("hbase.serial.replication.waiting.ms", 100);
 UTIL.startMiniCluster(3);
 // disable balancer
 UTIL.getAdmin().balancerSwitch(false, true);
 LOG_DIR = UTIL.getDataTestDirOnTestFS("replicated");
 FS = UTIL.getTestFileSystem();
 FS.mkdirs(LOG_DIR);
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUp() throws Exception {
 UTIL.getConfiguration().setStrings(CoprocessorHost.REGION_COPROCESSOR_CONF_KEY,
  DelayCloseCP.class.getName());
 UTIL.startMiniCluster(3);
 UTIL.getAdmin().balancerSwitch(false, true);
 UTIL.createTable(TABLE_NAME, CF);
 UTIL.waitTableAvailable(TABLE_NAME);
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void beforeClass() throws Exception {
 // Make servers report eagerly. This test is about looking at the cluster status reported.
 // Make it so we don't have to wait around too long to see change.
 UTIL.getConfiguration().setInt("hbase.regionserver.msginterval", MSG_INTERVAL);
 UTIL.startMiniCluster(4);
 admin = UTIL.getAdmin();
 admin.balancerSwitch(false, true);
 byte[] FAMILY = Bytes.toBytes("f");
 for (TableName tableName : tables) {
  Table table = UTIL.createMultiRegionTable(tableName, FAMILY, 16);
  UTIL.waitTableAvailable(tableName);
  UTIL.loadTable(table, FAMILY);
 }
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUp() throws Exception {
 UTIL.getConfiguration().setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, 600000);
 UTIL.getConfiguration().setClass(HConstants.REGION_IMPL, MockHRegion.class, HRegion.class);
 UTIL.startMiniCluster(3);
 UTIL.createTable(TABLE_NAME, CF);
 UTIL.getAdmin().balancerSwitch(false, true);
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUp() throws Exception {
 UTIL.startMiniCluster(3);
 UTIL.getAdmin().balancerSwitch(false, true);
 UTIL.createTable(TABLE_NAME, CF);
 UTIL.waitTableAvailable(TABLE_NAME);
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUp() throws Exception {
 TEST_UTIL.startMiniCluster(3);
 TEST_UTIL.getAdmin().balancerSwitch(false, true);
 AsyncRegistry registry = AsyncRegistryFactory.getRegistry(TEST_UTIL.getConfiguration());
 CONN = new AsyncConnectionImpl(TEST_UTIL.getConfiguration(), registry,
  registry.getClusterId().get(), User.getCurrent());
 LOCATOR = new AsyncNonMetaRegionLocator(CONN);
 SPLIT_KEYS = new byte[8][];
 for (int i = 111; i < 999; i += 111) {
  SPLIT_KEYS[i / 111 - 1] = Bytes.toBytes(String.format("%03d", i));
 }
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUp() throws Exception {
 TEST_UTIL.getConfiguration().set(BaseLoadBalancer.TABLES_ON_MASTER, "none");
 TEST_UTIL.getConfiguration().setInt(HConstants.META_REPLICAS_NUM, 3);
 TEST_UTIL.startMiniCluster(3);
 REGISTRY = AsyncRegistryFactory.getRegistry(TEST_UTIL.getConfiguration());
 RegionReplicaTestHelper.waitUntilAllMetaReplicasHavingRegionLocation(REGISTRY, 3);
 TEST_UTIL.getAdmin().balancerSwitch(false, true);
 LOCATOR = new AsyncMetaRegionLocator(REGISTRY);
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUp() throws Exception {
 UTIL.getConfiguration().setClass(HConstants.MASTER_IMPL, HMasterForTest.class, HMaster.class);
 UTIL.getConfiguration().setInt("hbase.regionserver.msginterval", 1000);
 UTIL.startMiniCluster(3);
 UTIL.getAdmin().balancerSwitch(false, true);
 UTIL.createTable(NAME, CF);
 UTIL.waitTableAvailable(NAME);
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUp() throws Exception {
 UTIL.getConfiguration().setInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, 1);
 UTIL.startMiniCluster(3);
 UTIL.createTable(TABLE_NAME, CF);
 UTIL.getAdmin().balancerSwitch(false, true);
 HRegionServer srcRs = UTIL.getRSForFirstRegionInTable(TABLE_NAME);
 if (!srcRs.getRegions(TableName.META_TABLE_NAME).isEmpty()) {
  RegionInfo metaRegion = srcRs.getRegions(TableName.META_TABLE_NAME).get(0).getRegionInfo();
  HRegionServer dstRs = UTIL.getOtherRegionServer(srcRs);
  UTIL.getAdmin().move(metaRegion.getEncodedNameAsBytes(),
   Bytes.toBytes(dstRs.getServerName().getServerName()));
  UTIL.waitFor(30000, () -> !dstRs.getRegions(TableName.META_TABLE_NAME).isEmpty());
 }
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUp() throws Exception {
 UTIL.getConfiguration().setInt(HConstants.HBASE_RPC_SHORTOPERATION_TIMEOUT_KEY, 60000);
 UTIL.startMiniCluster(
  StartMiniClusterOption.builder().numRegionServers(2).masterClass(MockHMaster.class).build());
 UTIL.createTable(TABLE_NAME, CF);
 UTIL.getAdmin().balancerSwitch(false, true);
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUp() throws Exception {
 UTIL.getConfiguration().setInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, 1);
 UTIL.getConfiguration().setBoolean("hbase.regionserver.hlog.enabled", false);
 UTIL.startMiniCluster(2);
 UTIL.createTable(TABLE_NAME, CF);
 UTIL.waitTableAvailable(TABLE_NAME);
 HRegionServer rs = UTIL.getRSForFirstRegionInTable(TABLE_NAME);
 if (!rs.getRegions(TableName.META_TABLE_NAME).isEmpty()) {
  HRegionServer rs1 = UTIL.getOtherRegionServer(rs);
  UTIL.moveRegionAndWait(
   UTIL.getMiniHBaseCluster().getRegions(TABLE_NAME).get(0).getRegionInfo(),
   rs1.getServerName());
 }
 UTIL.getAdmin().balancerSwitch(false, true);
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUpBeforeClass() throws Exception {
 TEST_UTIL.startMiniCluster(2);
 TEST_UTIL.getAdmin().balancerSwitch(false, true);
 TEST_UTIL.createTable(TABLE_NAME, FAMILY);
 TEST_UTIL.waitTableAvailable(TABLE_NAME);
 AsyncRegistry registry = AsyncRegistryFactory.getRegistry(TEST_UTIL.getConfiguration());
 CONN = new AsyncConnectionImpl(TEST_UTIL.getConfiguration(), registry,
  registry.getClusterId().get(), User.getCurrent());
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUp() throws Exception {
 UTIL.startMiniCluster(1);
 UTIL.getAdmin().balancerSwitch(false, true);
 UTIL.createTable(TableDescriptorBuilder.newBuilder(TABLE_NAME)
  .setColumnFamily(ColumnFamilyDescriptorBuilder.of("cf"))
  .setRegionReplication(REGION_REPLICATION).build(), new byte[][] { Bytes.toBytes(0) });
 UTIL.waitTableAvailable(TABLE_NAME);
 HMaster master = UTIL.getMiniHBaseCluster().getMaster();
 ENV = master.getMasterProcedureExecutor().getEnvironment();
 AM = master.getAssignmentManager();
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUp() throws Exception {
 UTIL.getConfiguration().setClass(HConstants.MASTER_IMPL, HMasterForTest.class, HMaster.class);
 UTIL
  .startMiniCluster(StartMiniClusterOption.builder().numMasters(2).numRegionServers(2).build());
 UTIL.createTable(NAME, CF);
 UTIL.waitTableAvailable(NAME);
 UTIL.getAdmin().balancerSwitch(false, true);
}

代码示例来源:origin: apache/hbase

@Before
public void setup() throws Exception {
 ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(getMasterProcedureExecutor(), false);
 // Turn off balancer so it doesn't cut in and mess up our placements.
 UTIL.getAdmin().balancerSwitch(false, true);
 // Turn off the meta scanner so it don't remove parent on us.
 UTIL.getHBaseCluster().getMaster().setCatalogJanitorEnabled(false);
 am = UTIL.getHBaseCluster().getMaster().getAssignmentManager();
 splitProcMetrics = am.getAssignmentManagerMetrics().getSplitProcMetrics();
 assignProcMetrics = am.getAssignmentManagerMetrics().getAssignProcMetrics();
 unassignProcMetrics = am.getAssignmentManagerMetrics().getUnassignProcMetrics();
}

代码示例来源:origin: apache/hbase

@Before
public void setup() throws Exception {
 resetProcExecutorTestingKillFlag();
 MasterProcedureTestingUtility.generateNonceGroup(UTIL.getHBaseCluster().getMaster());
 MasterProcedureTestingUtility.generateNonce(UTIL.getHBaseCluster().getMaster());
 // Turn off balancer so it doesn't cut in and mess up our placements.
 admin.balancerSwitch(false, true);
 // Turn off the meta scanner so it don't remove parent on us.
 UTIL.getHBaseCluster().getMaster().setCatalogJanitorEnabled(false);
 resetProcExecutorTestingKillFlag();
 am = UTIL.getHBaseCluster().getMaster().getAssignmentManager();
 mergeProcMetrics = am.getAssignmentManagerMetrics().getMergeProcMetrics();
 assignProcMetrics = am.getAssignmentManagerMetrics().getAssignProcMetrics();
 unassignProcMetrics = am.getAssignmentManagerMetrics().getUnassignProcMetrics();
}

相关文章

Admin类方法