How to list the regions in an HBase table through the shell?

Kevin Pauli picture Kevin Pauli · Dec 3, 2015 · Viewed 26.9k times · Source

I would like to get the same information about the regions of a table that appear in the web UI (i.e. region name, region server, start/end key, locality), but through the hbase shell.

(The UI is flaky/slow, and furthermore I want to process this information as part of a script.)

After much googling, I can't find out how, and this surprises me immensely. version is 1.0.0.-cdh5.4.0

Answer

Maddy RS picture Maddy RS · Dec 4, 2015

To get the region info about the table, you need to scan hbase:meta table.

scan 'hbase:meta',{FILTER=>"PrefixFilter('table_name')"}

This command will give details of all the regions. Row key will have region name and there will be four column qualifiers. You may need following two column qualifiers:

info:regioninfo - This qualifier contains STARTKEY and ENDKEY.

info:server - This qualifier contains region server details