本文整理了Java中org.apache.hadoop.hbase.client.Admin.enableTableReplication()
方法的一些代码示例,展示了Admin.enableTableReplication()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Admin.enableTableReplication()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Admin
类名称:Admin
方法名:enableTableReplication
[英]Enable a table's replication switch.
[中]启用表的复制开关。
代码示例来源:origin: apache/hbase
/**
* Enable a table's replication switch.
* @param tableName name of the table
* @throws IOException if a remote or network exception occurs
* @deprecated use {@link org.apache.hadoop.hbase.client.Admin#enableTableReplication(TableName)}
* instead
*/
@Deprecated
public void enableTableRep(final TableName tableName) throws IOException {
admin.enableTableReplication(tableName);
}
代码示例来源:origin: apache/hbase
@Test(expected = IllegalArgumentException.class)
public void testEnableReplicationWhenTableNameAsNull() throws Exception {
admin1.enableTableReplication(null);
}
代码示例来源:origin: apache/hbase
@Test(expected = TableNotFoundException.class)
public void testEnableReplicationForNonExistingTable() throws Exception {
admin1.enableTableReplication(TableName.valueOf(name.getMethodName()));
}
代码示例来源:origin: org.apache.hbase/hbase-client
/**
* Enable a table's replication switch.
* @param tableName name of the table
* @throws IOException if a remote or network exception occurs
* @deprecated use {@link org.apache.hadoop.hbase.client.Admin#enableTableReplication(TableName)}
* instead
*/
@Deprecated
public void enableTableRep(final TableName tableName) throws IOException {
admin.enableTableReplication(tableName);
}
代码示例来源:origin: apache/hbase
@Test
public void testEnableReplicationWhenTableDescriptorIsNotSameInClusters() throws Exception {
HTableDescriptor table = new HTableDescriptor(admin2.getTableDescriptor(tableName));
HColumnDescriptor f = new HColumnDescriptor("newFamily");
table.addFamily(f);
admin2.disableTable(tableName);
admin2.modifyTable(tableName, table);
admin2.enableTable(tableName);
try {
admin1.enableTableReplication(tableName);
fail("Exception should be thrown if table descriptors in the clusters are not same.");
} catch (RuntimeException ignored) {
}
admin1.disableTable(tableName);
admin1.modifyTable(tableName, table);
admin1.enableTable(tableName);
admin1.enableTableReplication(tableName);
table = admin1.getTableDescriptor(tableName);
for (HColumnDescriptor fam : table.getColumnFamilies()) {
assertEquals(HConstants.REPLICATION_SCOPE_GLOBAL, fam.getScope());
}
admin1.deleteColumnFamily(tableName, f.getName());
admin2.deleteColumnFamily(tableName, f.getName());
}
代码示例来源:origin: apache/hbase
@Test
public void testEnableReplicationWhenSlaveClusterDoesntHaveTable() throws Exception {
admin1.disableTableReplication(tableName);
admin2.disableTable(tableName);
admin2.deleteTable(tableName);
assertFalse(admin2.tableExists(tableName));
admin1.enableTableReplication(tableName);
assertTrue(admin2.tableExists(tableName));
}
代码示例来源:origin: apache/hbase
try {
adminExt.setPeerTableCFs(peerId, tableCfs);
admin1.enableTableReplication(TestReplicationBase.tableName);
assertFalse("Table should not be created if user has set table cfs explicitly for the "
+ "peer and this is not part of that collection",
admin1.enableTableReplication(TestReplicationBase.tableName);
assertTrue(
"Table should be created if user has explicitly added table into table cfs collection",
代码示例来源:origin: apache/hbase
@Test
public void testDisableAndEnableReplication() throws Exception {
admin1.disableTableReplication(tableName);
HTableDescriptor table = admin1.getTableDescriptor(tableName);
for (HColumnDescriptor fam : table.getColumnFamilies()) {
assertEquals(HConstants.REPLICATION_SCOPE_LOCAL, fam.getScope());
}
admin1.enableTableReplication(tableName);
table = admin1.getTableDescriptor(tableName);
for (HColumnDescriptor fam : table.getColumnFamilies()) {
assertEquals(HConstants.REPLICATION_SCOPE_GLOBAL, fam.getScope());
}
}
代码示例来源:origin: apache/hbase
@Test
public void testEnableReplicationWhenReplicationNotEnabled() throws Exception {
HTableDescriptor table = new HTableDescriptor(admin1.getTableDescriptor(tableName));
for (HColumnDescriptor fam : table.getColumnFamilies()) {
fam.setScope(HConstants.REPLICATION_SCOPE_LOCAL);
}
admin1.disableTable(tableName);
admin1.modifyTable(tableName, table);
admin1.enableTable(tableName);
admin2.disableTable(tableName);
admin2.modifyTable(tableName, table);
admin2.enableTable(tableName);
admin1.enableTableReplication(tableName);
table = admin1.getTableDescriptor(tableName);
for (HColumnDescriptor fam : table.getColumnFamilies()) {
assertEquals(HConstants.REPLICATION_SCOPE_GLOBAL, fam.getScope());
}
}
代码示例来源:origin: apache/hbase
@Test
public void testEnableReplicationForTableWithRegionReplica() throws Exception {
TableName tn = TableName.valueOf(name.getMethodName());
TableDescriptor td = TableDescriptorBuilder.newBuilder(tn)
.setRegionReplication(5)
.setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(noRepfamName).build())
.build();
admin1.createTable(td);
try {
admin1.enableTableReplication(tn);
td = admin1.getDescriptor(tn);
for (ColumnFamilyDescriptor fam : td.getColumnFamilies()) {
assertEquals(HConstants.REPLICATION_SCOPE_GLOBAL, fam.getScope());
}
} finally {
utility1.deleteTable(tn);
utility2.deleteTable(tn);
}
}
代码示例来源:origin: apache/hbase
admin.enableTableReplication(tableName);
代码示例来源:origin: com.aliyun.hbase/alihbase-client
/**
* Enable a table's replication switch.
* @param tableName name of the table
* @throws IOException if a remote or network exception occurs
* @deprecated use {@link org.apache.hadoop.hbase.client.Admin#enableTableReplication(TableName)}
* instead
*/
@Deprecated
public void enableTableRep(final TableName tableName) throws IOException {
admin.enableTableReplication(tableName);
}
代码示例来源:origin: org.apache.hbase/hbase-server
@Test(expected = IllegalArgumentException.class)
public void testEnableReplicationWhenTableNameAsNull() throws Exception {
admin1.enableTableReplication(null);
}
代码示例来源:origin: org.apache.hbase/hbase-server
@Test(expected = TableNotFoundException.class)
public void testEnableReplicationForNonExistingTable() throws Exception {
admin1.enableTableReplication(TableName.valueOf(name.getMethodName()));
}
代码示例来源:origin: org.apache.hbase/hbase-server
@Test
public void testEnableReplicationWhenTableDescriptorIsNotSameInClusters() throws Exception {
HTableDescriptor table = new HTableDescriptor(admin2.getTableDescriptor(tableName));
HColumnDescriptor f = new HColumnDescriptor("newFamily");
table.addFamily(f);
admin2.disableTable(tableName);
admin2.modifyTable(tableName, table);
admin2.enableTable(tableName);
try {
admin1.enableTableReplication(tableName);
fail("Exception should be thrown if table descriptors in the clusters are not same.");
} catch (RuntimeException ignored) {
}
admin1.disableTable(tableName);
admin1.modifyTable(tableName, table);
admin1.enableTable(tableName);
admin1.enableTableReplication(tableName);
table = admin1.getTableDescriptor(tableName);
for (HColumnDescriptor fam : table.getColumnFamilies()) {
assertEquals(HConstants.REPLICATION_SCOPE_GLOBAL, fam.getScope());
}
admin1.deleteColumnFamily(tableName, f.getName());
admin2.deleteColumnFamily(tableName, f.getName());
}
代码示例来源:origin: org.apache.hbase/hbase-server
@Test
public void testEnableReplicationWhenSlaveClusterDoesntHaveTable() throws Exception {
admin1.disableTableReplication(tableName);
admin2.disableTable(tableName);
admin2.deleteTable(tableName);
assertFalse(admin2.tableExists(tableName));
admin1.enableTableReplication(tableName);
assertTrue(admin2.tableExists(tableName));
}
代码示例来源:origin: org.apache.hbase/hbase-server
try {
adminExt.setPeerTableCFs(peerId, tableCfs);
admin1.enableTableReplication(TestReplicationBase.tableName);
assertFalse("Table should not be created if user has set table cfs explicitly for the "
+ "peer and this is not part of that collection",
admin1.enableTableReplication(TestReplicationBase.tableName);
assertTrue(
"Table should be created if user has explicitly added table into table cfs collection",
代码示例来源:origin: org.apache.hbase/hbase-server
@Test
public void testDisableAndEnableReplication() throws Exception {
admin1.disableTableReplication(tableName);
HTableDescriptor table = admin1.getTableDescriptor(tableName);
for (HColumnDescriptor fam : table.getColumnFamilies()) {
assertEquals(HConstants.REPLICATION_SCOPE_LOCAL, fam.getScope());
}
admin1.enableTableReplication(tableName);
table = admin1.getTableDescriptor(tableName);
for (HColumnDescriptor fam : table.getColumnFamilies()) {
assertEquals(HConstants.REPLICATION_SCOPE_GLOBAL, fam.getScope());
}
}
代码示例来源:origin: org.apache.hbase/hbase-server
@Test
public void testEnableReplicationWhenReplicationNotEnabled() throws Exception {
HTableDescriptor table = new HTableDescriptor(admin1.getTableDescriptor(tableName));
for (HColumnDescriptor fam : table.getColumnFamilies()) {
fam.setScope(HConstants.REPLICATION_SCOPE_LOCAL);
}
admin1.disableTable(tableName);
admin1.modifyTable(tableName, table);
admin1.enableTable(tableName);
admin2.disableTable(tableName);
admin2.modifyTable(tableName, table);
admin2.enableTable(tableName);
admin1.enableTableReplication(tableName);
table = admin1.getTableDescriptor(tableName);
for (HColumnDescriptor fam : table.getColumnFamilies()) {
assertEquals(HConstants.REPLICATION_SCOPE_GLOBAL, fam.getScope());
}
}
代码示例来源:origin: org.apache.hbase/hbase-it
admin.enableTableReplication(tableName);
内容来源于网络,如有侵权,请联系作者删除!