setRegionState (Hbck2)

Manually sets the state of a specific region in hbase:meta.

Info

This command is high risk and should be used only as a last resort in extreme situations.


Command Syntax

hbase hbck -j <path-to-hbck2-jar> setRegionState [<ENCODED_REGIONNAME> <STATE> | -i <INPUT_FILE>...]

Options

-i, --inputFiles <file1> [<file2>...] Specifies one or more files containing encoded region names and region states, one pair per line.


Possible Region States

OFFLINE, OPENING, OPEN, CLOSING, CLOSED SPLITTING, SPLIT, FAILED_OPEN, FAILED_CLOSE MERGING, MERGED, SPLITTING_NEW, MERGING_NEW ABNORMALLY_CLOSED

Description

Use this command when a region’s state in hbase:meta is incorrect and is blocking an operation such as assign or unassign. For example, an unassign operation may only proceed if the region is in one of the following states:

SPLITTING | SPLIT | MERGING | OPEN | CLOSING

Before running this command, you must ensure that no active procedure—such as assign, split, or merge—is currently handling the region. To verify this, use the list_procedures command in the HBase shell.

For tables with region replicas, the region identifier must include both:

  • The primary region’s encoded region name

  • The replica ID

Use the format:

<PRIMARY_ENCODED_REGIONNAME>,<REPLICA_ID> <STATE>

Return Values

  • "0" — The region state was successfully changed

  • "1" — The region state could not be changed


Examples

  1. Set a region to the CLOSING state:

hbase hbck -j <path-to-hbck2-jar> setRegionState de00010733901a05f5a2a3a382e27dd4 CLOSING
  1. Set region states from a file (fileName1):

Example contents of fileName1:

de00010733901a05f5a2a3a382e27dd4 OPEN anotherencodedregionname CLOSED

Run the command:

hbase hbck -j <path-to-hbck2-jar> setRegionState -i fileName1


  Last updated