本文整理了Java中org.apache.hadoop.hbase.client.Admin.balance()
方法的一些代码示例,展示了Admin.balance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Admin.balance()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Admin
类名称:Admin
方法名:balance
[英]Invoke the balancer. Will run the balancer and if regions to move, it will go ahead and do the reassignments. Can NOT run for various reasons. Check logs.
[中]调用平衡器。将运行平衡器,如果要移动区域,它将继续进行重新分配。由于各种原因无法运行。检查日志。
代码示例来源:origin: apache/hbase
/**
* Invoke the balancer. Will run the balancer and if regions to move, it will go ahead and do the
* reassignments. Can NOT run for various reasons. Check logs.
*
* @return <code>true</code> if balancer ran, <code>false</code> otherwise.
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
* Use {@link #balance()} instead.
*/
@Deprecated
default boolean balancer() throws IOException {
return balance();
}
代码示例来源:origin: apache/hbase
/**
* Invoke the balancer. Will run the balancer and if regions to move, it will
* go ahead and do the reassignments. If there is region in transition, force parameter of true
* would still run balancer. Can *not* run for other reasons. Check
* logs.
* @param force whether we should force balance even if there is region in transition
* @return <code>true</code> if balancer ran, <code>false</code> otherwise.
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
* Use {@link #balance(boolean)} instead.
*/
@Deprecated
default boolean balancer(boolean force) throws IOException {
return balance(force);
}
代码示例来源:origin: apache/hbase
@BeforeClass
public static void setUp() throws Exception {
UTIL.getConfiguration().setLong(ProcedureExecutor.WORKER_KEEP_ALIVE_TIME_CONF_KEY, 5000);
UTIL.getConfiguration().setInt(MasterProcedureConstants.MASTER_PROCEDURE_THREADS, 4);
UTIL.getConfiguration().set(CoprocessorHost.REGION_COPROCESSOR_CONF_KEY, MyCP.class.getName());
UTIL.startMiniCluster(3);
CORE_POOL_SIZE =
UTIL.getMiniHBaseCluster().getMaster().getMasterProcedureExecutor().getCorePoolSize();
TABLE_COUNT = 50 * CORE_POOL_SIZE;
List<Future<?>> futures = new ArrayList<>();
for (int i = 0; i < TABLE_COUNT; i++) {
futures.add(UTIL.getAdmin().createTableAsync(
TableDescriptorBuilder.newBuilder(TableName.valueOf(TABLE_NAME_PREFIX + i))
.setColumnFamily(ColumnFamilyDescriptorBuilder.of(CF)).build(),
null));
}
for (Future<?> future : futures) {
future.get(1, TimeUnit.MINUTES);
}
UTIL.getAdmin().balance(true);
UTIL.waitUntilNoRegionsInTransition();
}
代码示例来源:origin: apache/hbase
admin.balance(true);
Thread.sleep(5000);
ServerName metaServer = TEST_UTIL.getHBaseCluster().getServerHoldingMeta();
代码示例来源:origin: org.apache.hbase/hbase-client
/**
* Invoke the balancer. Will run the balancer and if regions to move, it will go ahead and do the
* reassignments. Can NOT run for various reasons. Check logs.
*
* @return <code>true</code> if balancer ran, <code>false</code> otherwise.
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
* Use {@link #balance()} instead.
*/
@Deprecated
default boolean balancer() throws IOException {
return balance();
}
代码示例来源:origin: org.apache.hbase/hbase-client
/**
* Invoke the balancer. Will run the balancer and if regions to move, it will
* go ahead and do the reassignments. If there is region in transition, force parameter of true
* would still run balancer. Can *not* run for other reasons. Check
* logs.
* @param force whether we should force balance even if there is region in transition
* @return <code>true</code> if balancer ran, <code>false</code> otherwise.
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
* Use {@link #balance(boolean)} instead.
*/
@Deprecated
default boolean balancer(boolean force) throws IOException {
return balance(force);
}
代码示例来源:origin: apache/hbase
@Test
public void testMasterSwitch() throws Exception {
// get an admin instance and issue some request first
Connection conn = TEST_UTIL.getConnection();
Admin admin = conn.getAdmin();
LOG.debug("Tables: " + admin.listTableDescriptors());
try {
MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
// switch active master
HMaster master = cluster.getMaster();
master.stopMaster();
while (!master.isShutDown()) {
Thread.sleep(200);
}
while (cluster.getMaster() == null || !cluster.getMaster().isInitialized()) {
Thread.sleep(200);
}
// confirm client access still works
Assert.assertTrue(admin.balance(false));
} finally {
admin.close();
}
}
代码示例来源:origin: com.aliyun.hbase/alihbase-client
/**
* Invoke the balancer. Will run the balancer and if regions to move, it will go ahead and do the
* reassignments. Can NOT run for various reasons. Check logs.
*
* @return <code>true</code> if balancer ran, <code>false</code> otherwise.
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
* Use {@link #balance()} instead.
*/
@Deprecated
default boolean balancer() throws IOException {
return balance();
}
代码示例来源:origin: com.aliyun.hbase/alihbase-client
/**
* Invoke the balancer. Will run the balancer and if regions to move, it will
* go ahead and do the reassignments. If there is region in transition, force parameter of true
* would still run balancer. Can *not* run for other reasons. Check
* logs.
* @param force whether we should force balance even if there is region in transition
* @return <code>true</code> if balancer ran, <code>false</code> otherwise.
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
* Use {@link #balance(boolean)} instead.
*/
@Deprecated
default boolean balancer(boolean force) throws IOException {
return balance(force);
}
代码示例来源:origin: org.apache.hbase/hbase-server
@BeforeClass
public static void setUp() throws Exception {
UTIL.getConfiguration().setLong(ProcedureExecutor.WORKER_KEEP_ALIVE_TIME_CONF_KEY, 5000);
UTIL.getConfiguration().setInt(MasterProcedureConstants.MASTER_PROCEDURE_THREADS, 4);
UTIL.getConfiguration().setInt(MasterProcedureConstants.MASTER_URGENT_PROCEDURE_THREADS, 0);
UTIL.getConfiguration().set(CoprocessorHost.REGION_COPROCESSOR_CONF_KEY, MyCP.class.getName());
UTIL.startMiniCluster(3);
CORE_POOL_SIZE =
UTIL.getMiniHBaseCluster().getMaster().getMasterProcedureExecutor().getCorePoolSize();
TABLE_COUNT = 50 * CORE_POOL_SIZE;
List<Future<?>> futures = new ArrayList<>();
for (int i = 0; i < TABLE_COUNT; i++) {
futures.add(UTIL.getAdmin().createTableAsync(
TableDescriptorBuilder.newBuilder(TableName.valueOf(TABLE_NAME_PREFIX + i))
.setColumnFamily(ColumnFamilyDescriptorBuilder.of(CF)).build(),
null));
}
for (Future<?> future : futures) {
future.get(1, TimeUnit.MINUTES);
}
UTIL.getAdmin().balance(true);
UTIL.waitUntilNoRegionsInTransition();
}
代码示例来源:origin: org.apache.hbase/hbase-server
admin.balance(true);
Thread.sleep(5000);
ServerName metaServer = TEST_UTIL.getHBaseCluster().getServerHoldingMeta();
代码示例来源:origin: org.apache.hbase/hbase-server
@Test
public void testMasterSwitch() throws Exception {
// get an admin instance and issue some request first
Connection conn = TEST_UTIL.getConnection();
Admin admin = conn.getAdmin();
LOG.debug("Tables: " + admin.listTableDescriptors());
try {
MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
// switch active master
HMaster master = cluster.getMaster();
master.stopMaster();
while (!master.isShutDown()) {
Thread.sleep(200);
}
while (cluster.getMaster() == null || !cluster.getMaster().isInitialized()) {
Thread.sleep(200);
}
// confirm client access still works
Assert.assertTrue(admin.balance(false));
} finally {
admin.close();
}
}
内容来源于网络,如有侵权,请联系作者删除!