有的时候HBase的表在enable的过程中出现问题,导致最终状态处于中间状态,而这个时候客户端又没有办法使用这个表。这里分析一下一个case
env
hbase 0.98.0.2.1.3.7-18-hadoop2
版本比较老
Issue
如下的表的状态就处于中间状态
hbase(main):011:0> is_enabled 'prod_eglesprk_tasks'
false
0 row(s) in 0.0680 seconds
hbase(main):012:0> is_disabled 'prod_eglesprk_tasks'
false
0 row(s) in 0.0510 seconds
从页面上看是这样的
表的状态是什么
通过如下代码可以查询出来当前处于enabling状态的表的名字,这段代码源自于hmaster如何查询table状态的代码
可以确认这个表处于enabling状态
Configuration conf = HBaseConfiguration.create();
conf.set("ha.zookeeper.quorum", "127.0.0.1:2181");
String node = "/hbase/testSecuritySingleSuperuser";
ZooKeeperWatcher watcher = new ZooKeeperWatcher(conf, node, null, false);
Set<TableName> disablingOrDisabled = ZKTable.getEnablingTables(watcher);
for (TableName tb : disablingOrDisabled){
System.out.println(tb.getNameAsString());
}
核心pom.xml
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.5</version>
<exclusions>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>