setTableState (Hbck2)
Manually sets the state of an HBase table.
Command Syntax
hbase hbck -j <path-to-hbck2-jar> setTableState [<TABLENAME> <STATE> | -i <INPUT_FILE>...]
Options
-i, --inputFiles <file1> [<file2>...] Specifies one or more files containing table names and table states, one pair per line.
Possible Table States
ENABLED
DISABLED
DISABLING
ENABLING
Description
This command forcefully sets the state of a table in HBase. It is typically used when a table becomes stuck in an incorrect or inconsistent state.
You can check a table’s current state using the HBase shell:
hbase> get 'hbase:meta', '<TABLENAME>', 'table:state'
Common cell values include:
- \x08\x00 → ENABLED
- \x08\x01 → DISABLED
You can also use:
hbase> describe "<TABLENAME>"
This provides a more readable view of the table schema and its current state.
Return Value
The command returns the previous state of the table before the update was applied.
Examples
- Enable the users table:
hbase hbck -j <path-to-hbck2-jar> setTableState users ENABLED
- Set table states from a file (fileName1):
Example fileName1 contents:
mytable DISABLED
another_table ENABLED
Run the command:
hbase hbck -j <path-to-hbck2-jar> setTableState -i fileName1
