apache Hbase2.x disbale 表卡住
1、现象
通过hbase shell disble 表,显示表已经被disable了,但是在drop table 时,又显示出现表被disable
2、分析
通过命令查看表的状态
is_disabled 'Employee'
通过原数据查看表的状态
get "hbase:meta","Employee","table:state"
一般正常情况下可以发现value为\x08\x03,正常的值是\x08\x00(Enabled)或者\x08\x01(Disabled)
https://donsnotes.com/tech/charsets/ascii.html
3、解决方法
方式1:修改表元数据
通过修改hbase meta表里面对应表的状态,这种方式目前试了一下,貌似对我这边没什么用。具体的思路如下:
修改hbase:meta 把表对应的状态置为开启或者关闭状态
hbase> put "hbase:meta","Employee","table:state",value="\b\01"
查看是否被修改
hbase> get "hbase:meta","Employee","table:state"
查看表状态
hbase> is_disabled 'Employee' false hbase> is_enabled 'Employee' true
尝试drop table
不能正常删除,还是显示表的状态为disableing
drop 'Employee'
方式2:通过hbase2.x 修复工具
设置表状态
./bin/hbase --config /opt/hbase/conf/ hbck -j hbase-operator-tools-1.2.0/hbase-hbck2/hbase-hbck2-1.2.0.jar setTableState Employee DISABLED
表状态分为:enable,disable。enabling,disabling
不过在开始操作之前,最好看一下该表所有region对应的状态,否则,就算设置为DISABLE状态,在删除的时候依然不能正常删除。
2)查看当前表所有的region状态
./bin/hbase shell <<< "scan 'hbase:meta', {FILTER=>\"PrefixFilter('Employee')\"}" |grep "info:state"
如果表region状态跟你预想的不一样,可以通过HBCK2 设置region的状态
4) 删除表