索引读修复
开启索引读修复的情况下,当查询数据表时使用到索引,并且扫描到无效索引数据,会修复索引数据跟数据表一致。
场景介绍
在写入数据的过程中,可能存在索引表写入失败,或者数据表写入失败的情况,会存在无效的索引数据。若未开启读修复,无效索引数据会被视为有效数据返回。
使用方法
- 登录管理节点服务器,停止HBase服务。
/usr/local/hbase/bin/stop-hbase.sh
- 打开HBase的配置文件hbase-site.xml。
vi /usr/local/hbase/conf/hbase-site.xml
- 按“i”进入编辑模式,修改如下参数值,如参数不存在新增即可。
<property> <name>hbase.regionserver.global.index.read.repair.enabled</name> <value>true</value> </property> <property> <name>hbase.regionserver.global.index.row.delete.age.threshold</name> <value>60000</value> </property>
hbase.regionserver.global.index.row.delete.age.threshold参数默认值为60000,单位:ms,用户可根据实际情况进行修改。
- 按“Esc”键,输入:wq!,按“Enter”保存并退出编辑。
- 登录管理节点服务器,重新启动HBase服务。
/usr/local/hbase/bin/start-hbase.sh