Checking and Repairing HBase Tables

HBaseFsck (hbck) is a command-line tool that checks for region consistency and table integrity problems and repairs corruption. It works in two basic
modes — a read-only inconsistency identifying mode and a multi-phase read-write repair mode.

Read-only inconsistency identification: In this mode, which is the default, a report is generated but no repairs are attempted.

Read-write repair mode: In this mode, if errors are found, hbck attempts to repair them.

Always run HBase administrative commands such as the HBase Shell, hbck, or bulk-load commands as the HBase user (typically hbase).

Running hbck Manually

The hbck command is located in the bin directory of the HBase install.

With no arguments, hbck checks HBase for inconsistencies and prints OK if no inconsistencies are found, or the number of inconsistencies otherwise.

With the -details argument, hbck checks HBase for inconsistencies and prints a detailed report.

To limit hbck to only checking specific tables, provide them as a space-separated list: hbck <table1><table2>

Warning: The following hbck options modify HBase metadata and are dangerous. They are not coordinated by the
HMaster and can cause further corruption by conflicting with commands that are currently in progress or coordinated by the HMaster. Even if the HMaster is down, it may try to recover the latest
operation when it restarts. These options should only be used as a last resort. The hbck command can only fix actual HBase metadata corruption and is not a
general-purpose maintenance tool. Before running these commands, consider contacting Cloudera Support for guidance. In addition, running any of these commands requires an HMaster restart.

If region-level inconsistencies are found, use the -fix argument to direct hbck to try to fix them. The following sequence
of steps is followed:

The standard check for inconsistencies is run.

If needed, repairs are made to tables.

If needed, repairs are made to regions. Regions are closed during repair.

You can also fix individual region-level inconsistencies separately, rather than fixing them automatically with the -fix argument.

If this documentation includes code, including but not limited to, code examples, Cloudera makes this available to you under the terms of the Apache License, Version 2.0, including any required
notices. A copy of the Apache License Version 2.0 can be found here.