---
title: 索引读修复
description: "开启索引读修复的情况下，当查询数据表时使用到索引，并且扫描到无效索引数据，会修复索引数据跟数据表一致。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/2300/bds/kunpengbds_omniruntime_20_0212.html
sourcePath: /source/zh/kunpengboostkithistory/2300/bds/kunpengbds_omniruntime_20_0212.html
indexId: e634daac542f7e67578a1c4f6f9b202eec824147776a047c7f97169fb4790a0878
---
# 索引读修复

开启索引读修复的情况下，当查询数据表时使用到索引，并且扫描到无效索引数据，会修复索引数据跟数据表一致。

#### 场景介绍

在写入数据的过程中，可能存在索引表写入失败，或者数据表写入失败的情况，会存在无效的索引数据。若未开启读修复，无效索引数据会被视为有效数据返回。


#### 使用方法

1. 登录管理节点服务器，停止HBase服务。

```
/usr/local/hbase/bin/stop-hbase.sh
```


2. 打开HBase的配置文件hbase-site.xml。

```
vi /usr/local/hbase/conf/hbase-site.xml
```


3. 按“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，用户可根据实际情况进行修改。

4. 按“Esc”键，输入:wq!，按“Enter”保存并退出编辑。
5. 登录管理节点服务器，重新启动HBase服务。

```
/usr/local/hbase/bin/start-hbase.sh
```
