1.1 现象

通过hbase shell disable表,显示表以及关闭,但是使用drop table_name,却显示表状态为disableing,不能正常被删除。

hbase 不能disabled hbase disable table_jar

1.2 分析

1)通过以下命令查看表状态:

hbase> is_disabled table_name
false
hbase> is_enabled table_name
false

通过查看表的状态发现,当前表既没有开启也没有关闭。
2)查看当前表对应的元数据

hbase> get "hbase:meta","table_name","table:state"

hbase 不能disabled hbase disable table_bc_02


可以发现value为\x08\x02,正常的值是\x08\x00(Enabled)或者\x08\x01(Disabled)

常见的Control Characters

1.3 解决:

方式1:修改表元数据
通过修改hbase meta表里面对应表的状态,这种方式目前试了一下,貌似对我这边没什么用。具体的思路如下:

  1. 修改hbase:meta 把表对应的状态置为开启或者关闭状态
hbase> put "hbase:meta","table_name","table_state",value="\b\0"
  1. 查看是否被修改
hbase> get "hbase:meta","table_name","table_state"
  1. 查看表状态
hbase> is_disabled table_name
false
hbase> is_enabled table_name
true
  1. 尝试drop table
    不能正常删除,还是显示表的状态为disableing

借鉴:
| https://community.cloudera.com/t5/Support-Questions/Hbase-table-is-stuck-in-quot-Disabling-quot-state-Neither/m-p/235112

方式2:通过hbase2.x 修复工具

  1. 设置表状态
# hbase hbck -j xxx.jar table_name  state

表状态分为:enable,disable。enabling,disabling

hbase 不能disabled hbase disable table_jar_03

不过在开始操作之前,最好看一下该表所有region对应的状态,否则,就算设置为DISABLE状态,在删除的时候依然不能正常删除。
2)查看当前表所有的region状态

# hbase shell <<< "scan 'hbase:meta', {FILTER=>\"PrefixFilter('table_name')\"}" |grep "info:state"
  1. 如果表region状态跟你预想的不一样,可以通过HBCK2 设置region的状态

HBCK2使用

4) 删除表

hbase 不能disabled hbase disable table_jar_04