本文整理了Java中org.apache.hadoop.hbase.HBaseTestingUtility.getAdmin()
方法的一些代码示例,展示了HBaseTestingUtility.getAdmin()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HBaseTestingUtility.getAdmin()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.HBaseTestingUtility
类名称:HBaseTestingUtility
方法名:getAdmin
[英]Returns an Admin instance which is shared between HBaseTestingUtility instance users. Closing it has no effect, it will be closed automatically when the cluster shutdowns
[中]返回一个管理实例,该实例在hbasetestinguility实例用户之间共享。关闭它无效,当群集关闭时,它将自动关闭
代码示例来源:origin: apache/hbase
@Override
public void run() {
try {
UTIL2.getAdmin().transitReplicationPeerSyncReplicationState(PEER_ID,
SyncReplicationState.DOWNGRADE_ACTIVE);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
};
代码示例来源:origin: apache/hbase
@Before
public void beforeMethod() throws Exception {
Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE_NAME)) {
TEST_UTIL.deleteTable(TABLE_NAME);
}
HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TABLE));
htd.addFamily(new HColumnDescriptor(CFA));
htd.addFamily(new HColumnDescriptor(CFB));
admin.createTable(htd);
}
代码示例来源:origin: apache/hbase
NamespaceDescriptor createNamespace() throws Exception {
NamespaceDescriptor nd = NamespaceDescriptor.create("ns" + counter.getAndIncrement()).build();
testUtil.getAdmin().createNamespace(nd);
return nd;
}
代码示例来源:origin: apache/hbase
@AfterClass
public static void tearDownAfterClass() throws Exception {
TEST_UTIL.getAdmin().disableTable(TABLE);
TEST_UTIL.getAdmin().deleteTable(TABLE);
REST_TEST_UTIL.shutdownServletContainer();
TEST_UTIL.shutdownMiniCluster();
}
代码示例来源:origin: apache/hbase
@BeforeClass
public static void beforeAllTests() throws Exception {
// we will retry operations when PleaseHoldException is thrown
TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 3);
TEST_UTIL.getConfiguration().setBoolean(QuotaUtil.QUOTA_CONF_KEY, true);
// Start a cluster of two regionservers.
TEST_UTIL.startMiniCluster(1);
TestNamespaceAuditor.waitForQuotaInitialize(TEST_UTIL);
admin = TEST_UTIL.getAdmin();
}
代码示例来源:origin: apache/hbase
/**
* @throws java.lang.Exception
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
TEST_UTIL.startMiniCluster();
admin = new ReplicationAdmin(TEST_UTIL.getConfiguration());
hbaseAdmin = TEST_UTIL.getAdmin();
}
代码示例来源:origin: apache/hbase
@BeforeClass
public static void setUpBeforeClass() throws Exception {
TEST_UTIL.getConfiguration().setLong(HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD, timeout);
TEST_UTIL.startMiniCluster(MINICLUSTER_SIZE);
TEST_UTIL.getAdmin().setBalancerRunning(false, true);
TABLE = createTestTable(TABLE_NAME, ROWS, FAMILIES, QUALIFIERS, VALUE);
}
代码示例来源:origin: apache/hbase
@After
public void tearDown() throws Exception {
TEST_UTIL.deleteTable(tableName);
SnapshotTestingUtils.deleteAllSnapshots(TEST_UTIL.getAdmin());
SnapshotTestingUtils.deleteArchiveDirectory(TEST_UTIL);
}
代码示例来源:origin: apache/hbase
@Test
public void testMetaHTDReplicaCount() throws Exception {
assertTrue(TEST_UTIL.getAdmin().getTableDescriptor(TableName.META_TABLE_NAME)
.getRegionReplication() == 3);
}
代码示例来源:origin: apache/hbase
@Test
public void testEnableTableReplication() throws Exception {
admin.enableTableRep(tableName);
assertTrue(utility2.getAdmin().tableExists(tableName));
}
代码示例来源:origin: apache/hbase
@BeforeClass
public static void setUp() throws Exception {
UTIL.startMiniCluster(1);
try (Table table = UTIL.createTable(TABLE_NAME, CF)) {
for (int i = 0; i < COUNT; i++) {
table.put(new Put(Bytes.toBytes(i)).addColumn(CF, CQ, Bytes.toBytes(i)));
}
}
HRI = UTIL.getAdmin().getTableRegions(TABLE_NAME).get(0);
STUB = ((ConnectionImplementation) UTIL.getConnection())
.getClient(UTIL.getHBaseCluster().getRegionServer(0).getServerName());
}
代码示例来源:origin: apache/hbase
@Test(expected = DoNotRetryIOException.class)
public void testCreateTableWithZeroRegionReplicas() throws Exception {
TableName tableName = TableName.valueOf(name.getMethodName());
TableDescriptor desc = TableDescriptorBuilder.newBuilder(tableName)
.setColumnFamily(ColumnFamilyDescriptorBuilder.of(Bytes.toBytes("cf")))
.setRegionReplication(0)
.build();
TEST_UTIL.getAdmin().createTable(desc);
}
代码示例来源:origin: apache/hbase
@Before
public void setUp() throws IOException {
tableName = TableName.valueOf(name.getMethodName());
TableDescriptor htd = TableDescriptorBuilder.newBuilder(tableName)
.setCoprocessor(SleepAndFailFirstTime.class.getName())
.setColumnFamily(ColumnFamilyDescriptorBuilder.of(FAM_NAM)).build();
TEST_UTIL.getAdmin().createTable(htd);
}
代码示例来源:origin: apache/hbase
private void checkTableIsIllegal(HTableDescriptor htd) throws IOException {
Admin admin = TEST_UTIL.getAdmin();
try {
admin.createTable(htd);
fail();
} catch(Exception ex) {
// should throw ex
}
assertFalse(admin.tableExists(htd.getTableName()));
}
}
代码示例来源:origin: apache/hbase
@After
public void tearDown() throws Exception {
ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(getMasterProcedureExecutor(), false);
for (TableDescriptor htd: UTIL.getAdmin().listTableDescriptors()) {
LOG.info("Tear down, remove table=" + htd.getTableName());
UTIL.deleteTable(htd.getTableName());
}
}
代码示例来源:origin: apache/hbase
@After
public void tearDown() throws Exception {
ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(getMasterProcedureExecutor(), false);
for (TableDescriptor htd : UTIL.getAdmin().listTableDescriptors()) {
UTIL.deleteTable(htd.getTableName());
}
}
代码示例来源:origin: apache/hbase
@After
public void tearDown() throws Exception {
assertTrue("expected executor to be running", getMasterProcedureExecutor().isRunning());
ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(getMasterProcedureExecutor(), false);
for (HTableDescriptor htd: UTIL.getAdmin().listTables()) {
LOG.info("Tear down, remove table=" + htd.getTableName());
UTIL.deleteTable(htd.getTableName());
}
}
代码示例来源:origin: apache/hbase
@Override
protected Table createTable(byte[] fam) throws IOException {
TableName tableName = TableName.valueOf(testName.getMethodName());
TEST_UTIL.getAdmin()
.createTable(TableDescriptorBuilder.newBuilder(tableName)
.setColumnFamily(
ColumnFamilyDescriptorBuilder.newBuilder(fam).setNewVersionBehavior(true).build())
.build());
return TEST_UTIL.getConnection().getTable(tableName);
}
}
代码示例来源:origin: apache/hbase
@BeforeClass
public static void setupCluster() throws Exception {
setupConf(conf);
UTIL.startMiniCluster(2);
cluster = UTIL.getHBaseCluster();
assertNotNull(cluster);
admin = UTIL.getAdmin();
assertNotNull(admin);
master = cluster.getMaster();
assertNotNull(master);
}
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!