---
title: 安装OmniHBaseGSI全局二级索引特性
description: "在管理节点停止HBase服务并在所有节点安装OmniHBaseGSI全局二级索引软件。集群默认未启用OmniHBaseGSI全局二级索引功能，若使用需手动修改相关配置并重启HBase服务。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/2300/bds/kunpengbds_omniruntime_20_0192.html
sourcePath: /source/zh/kunpengboostkithistory/2300/bds/kunpengbds_omniruntime_20_0192.html
indexId: 0f8956c2e26c4cb01bd38a10d167a4165179ee2b309042f8bbe1263c62f1fd8078
---
# 安装OmniHBaseGSI全局二级索引特性

在管理节点停止HBase服务并在所有节点安装OmniHBaseGSI全局二级索引软件。集群默认未启用OmniHBaseGSI全局二级索引功能，若使用需手动修改相关配置并重启HBase服务。

1. 登录管理节点，停止HBase服务。
  1 /usr/local/hbase/bin/stop-hbase.sh

2. 在所有节点安装OmniHBaseGSI全局二级索引。
  将表3中获取到OmniHBaseGSI全局二级索引软件安装包上传至服务器，解压后将JAR包放至“/usr/local/hbase/lib”目录下。 1 2 3 4 5 6 unzip BoostKit-hindex_1.0.0.zip tar -xvf boostkit-hbase-index-1.0.0-aarch64.tar.gz chmod 550 boostkit-hbase-index-1.0.0-aarch64.jar chmod 550 boostkit-hbase-index-client-1.0.0-aarch64.jar cp boostkit-hbase-index-1.0.0-aarch64.jar /usr/local/hbase/lib cp boostkit-hbase-index-client-1.0.0-aarch64.jar /usr/local/hbase/lib

3. 在所有节点修改HBase配置文件。

  a. 出于安全加固的考量，将OmniHBaseGSI全局二级索引用到HBase配置文件的目录和日志文件的目录权限改为750，配置文件和日志文件的权限改为640。
    1 2 3 4 chmod 750 /usr/local/hbase/conf/ chmod 750 /usr/local/hbase/logs/ chmod 640 /usr/local/hbase/conf/hbase-site.xml chmod 640 /usr/local/hbase/logs/*

  b. 打开HBase的配置文件hbase-site.xml。
    1 vi /usr/local/hbase/conf/hbase-site.xml

  c. 按“i”进入编辑模式，添加如下参数，下列参数为必选，遗漏可能会导致服务启动失败。
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 <property> <name>hbase.coprocessor.master.classes</name> <value>com.huawei.boostkit.hindex.master.GlobalIndexMasterCoprocessor</value> </property> <property> <name>hbase.coprocessor.regionserver.classes</name> <value>com.huawei.boostkit.hindex.regionserver.GlobalIndexRegionServerCoprocessor</value> </property> <property> <name>hbase.coprocessor.region.classes</name> <value>com.huawei.boostkit.hindex.GlobalIndexRegionObserver</value> </property> <property> <name>hbase.client.connection.impl</name> <value>org.apache.hadoop.hbase.client.IndexConnectionImplementation</value> </property>

**表1 配置参数说明**

| 参数名称 | 参数值 | 说明 |
| --- | --- | --- |
| hbase.coprocessor.master.classes | com.huawei.boostkit.hindex.master.GlobalIndexMasterCoprocessor | 新增HMaster级别协处理器，用于支持索引DDL操作，例如创建索引、删除索引、修改索引状态等功能。 |
| hbase.coprocessor.regionserver.classes | com.huawei.boostkit.hindex.regionserver.GlobalIndexRegionServerCoprocessor | 新增RegionServer级别协处理器，用于管理RegionServer中索引缓存等功能。 |
| hbase.coprocessor.region.classes | com.huawei.boostkit.hindex.GlobalIndexRegionObserver | 新增Region级别协处理器，用于支持修改数据表时同步修改索引表。 |
| hbase.client.connection.impl | org.apache.hadoop.hbase.client.IndexConnectionImplementation | 新增Connection实现类，用于支持拦截scan请求，支持查询索引表进行加速。 |


  d. 可选：下列参数请根据实际情况选择添加。
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 <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> <property> <name>hbase.gsi.max.index.count.per.table</name> <value>5</value> </property> <property> <name>hbase.client.max.filter.depth</name> <value>10</value> </property> <property> <name>hbase.client.max.filter.length</name> <value>50</value> </property>

**表2 配置参数说明**

| 参数名称 | 参数值 | 说明 |
| --- | --- | --- |
| hbase.regionserver.global.index.read.repair.enabled | true | 用于开启OmniHBaseGSI读修复功能，默认值为“false”。建议开启。 |
| hbase.regionserver.global.index.row.delete.age.threshold | 60000 | 用于设置索引读修复时，旧数据老化删除时间，默认为1分钟，单位：ms。 |
| hbase.gsi.max.index.count.per.table | 5 | 用于设置单个数据表支持创建的索引最大个数，默认值为“5”。 |
| hbase.client.max.filter.depth | 10 | 用于设置scan所应用的Filter的最大嵌套深度，默认值为10。此配置用于避免恶意Filter攻击。 |
| hbase.client.max.filter.length | 50 | 用于设置scan所应用的Filter的最大长度，默认值为50。此配置用于避免恶意Filter攻击。 |


  e. 按“Esc”键，输入:wq!，按“Enter”保存并退出编辑。
4. 登录管理节点服务器，重新启动HBase服务。
  1 /usr/local/hbase/bin/start-hbase.sh
