索引信息中的索引状态反映了索引当前的使用情况,总共有正常、被禁用、异常、正在生成、正在被删除五种状态,可通过命令对状态进行修改。
索引状态反映了索引当前的使用情况,全局二级索引支持以下五种状态。
索引各种状态之间的转化条件如图1所示。
用户可以使用全局二级索引工具或者调用API修改索引状态。
执行以下命令可禁用/启用某个索引。
hbase com.huawei.boostkit.hindex.mapreduce.GlobalTableIndexer -Dtablename.to.index='table' -D[idx_state_opt]='idx1'
命令参数说明:
例如:修改状态为ACTIVE的tablename表的索引idx_1的状态为UNUSABLE。
1
|
hbase com.huawei.boostkit.hindex.mapreduce.GlobalTableIndexer -Dtablename.to.index='tablename' -Dindexnames.to.unusable='idx_1' |
执行成功后,再次查看索引信息。
1
|
hbase com.huawei.boostkit.hindex.mapreduce.GlobalTableIndexer -Dtablename.to.show=tablename |
结果如下图所示,idx_1的索引状态已被修改为UNUSABLE。
1 2 3 |
The index information of table : IndexName : idx_0, IndexColumns : [cf_0:q_0 -> type:STRING, cf_0:q_1 -> type:STRING], CoveredColumns : [cf_0:q_0 -> type:STRING], IndexState : ATIVE IndexName : idx_1, IndexColumns : [cf_0:q_0 -> type:STRING, cf_0:q_1 -> type:STRING, cf_0:q_2 -> type:STRING], CoveredColumns : [], IndexState : UNUSABLE |