本文整理了Java中org.apache.hadoop.hbase.client.Admin.createTableAsync()
方法的一些代码示例,展示了Admin.createTableAsync()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Admin.createTableAsync()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Admin
类名称:Admin
方法名:createTableAsync
[英]Creates a new table but does not block and wait for it to come online. Asynchronous operation. To check if the table exists, use #isTableAvailable -- it is not safe to create an HTable instance to this table before it is available. Note : Avoid passing empty split key. Throws IllegalArgumentException Bad table name, if the split keys are repeated and if the split key has empty byte array.
[中]创建一个新表,但不阻塞并等待它联机。异步操作。要检查该表是否存在,请使用#isTableAvailable——在该表可用之前为此表创建一个HTable实例是不安全的。注意:避免传递空分割键。如果拆分键重复且拆分键具有空字节数组,则抛出IllegalArgumentException错误的表名。
代码示例来源:origin: apache/hbase
@Test
public void testMRegions() throws Exception {
byte[][] splitKeys = new byte[500][];
for (int i = 0; i < splitKeys.length; ++i) {
splitKeys[i] = Bytes.toBytes(String.format("%08d", i));
}
TableDescriptor htd =
MasterProcedureTestingUtility.createHTD(TableName.valueOf("TestMRegions"), F1, F2);
UTIL.getAdmin().createTableAsync(htd, splitKeys).get(10, java.util.concurrent.TimeUnit.HOURS);
}
}
代码示例来源: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/phoenix
+ ") supports WAL Compression.", server.isAborted());
} else {
admin.createTableAsync(desc, null);
代码示例来源:origin: org.apache.hbase/hbase-server
@Test
public void testMRegions() throws Exception {
byte[][] splitKeys = new byte[500][];
for (int i = 0; i < splitKeys.length; ++i) {
splitKeys[i] = Bytes.toBytes(String.format("%08d", i));
}
TableDescriptor htd =
MasterProcedureTestingUtility.createHTD(TableName.valueOf("TestMRegions"), F1, F2);
UTIL.getAdmin().createTableAsync(htd, splitKeys).get(10, java.util.concurrent.TimeUnit.HOURS);
}
}
代码示例来源: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();
}
内容来源于网络,如有侵权,请联系作者删除!