Updated on 2024-11-29 GMT+08:00

Checking Consistency and Rebuilding Index Data

Scenarios

You can use the GSI tool to check the consistency between table data and index data. If they are inconsistent, use this tool to rebuild index data.

How to Use

Run the following command on the HBase client to check data consistency. If data is inconsistent, index data will be rebuilt. The consistency check result is saved to the {NameSpace where the data table is}:GSI_INCONSISTENCY_TABLE table.

hbase org.apache.hadoop.hbase.hindex.global.tools.GlobalHIndexConsistencyTool -dt table1 -n idx3 -src BOTH -r

The parameters are described as follows:

  • -dt,--data-table: indicates the name of the data table where you want to check the consistency.
  • -n,--index-name: indicates the name of the index where you want to check the consistency.
  • -src,--source: indicates source tables used in the check. The default value is BOTH. The following modes are supported:
    • INDEX_TABLE_SOURCE: The index table is used as the source table.
    • DATA_TABLE_SOURCE: The data table is used as the source table.
    • BOTH: Both index tables and data tables are used as the source tables.
  • -r,--repair: indicates the index data rebuilding option. The index data will be repaired after the check.
  • (Optional) -sc,--scan-caching: indicates the size of scan caching in a MapReduce job for consistency check or index data rebuilding.