How to list regions in a HBase table through a wrapper?

I would like to get the same information about the regions of the table that are displayed in the web interface (that is, the region name, region server, start / end key, locality), but through the hbase shell.

(The user interface is flaky / slow, and in addition, I want to process this information as part of the script.)

After long searches, I can’t understand how it is, and it really surprised me. version 1.0.0.-cdh5.4.0

+16
hbase
source share
5 answers

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

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

This command will provide information about all regions. The Row key will have a region name, and there will be four column classifiers. You may need the following two column classifiers:

info:regioninfo - This qualifier contains STARTKEY and ENDKEY.

info:server - This identifier contains information about the region server

+35
source share

Here is the answer from the HBase mailing list:

the status "detailed" will show you enough information for example

 t1,30,1449175546660.da5f3853f6e59d1ada0a8554f12885ab." numberOfStores=1, numberOfStorefiles=0, storefileUncompressedSizeMB=0, lastMajorCompactionTimestamp=0, storefileSizeMB=0, memstoreSizeMB=0, storefileIndexSizeMB=0, readRequestsCount=0, writeRequestsCount=0, rootIndexSizeKB=0, totalStaticIndexSizeKB=0, totalStaticBloomSizeKB=0, totalCompactingKVs=0, currentCompactedKVs=0, compactionProgressPct=NaN, completeSequenceId=-1, dataLocality=0.0 

However, this returns information from all tables, and you need to analyze the regions of the table you are interested in.

+3
source share

Use the "official" list_regions shell list_regions to display all regions. Please note that this tool is only available from HBase 1.4 and higher.

 Some examples are Examples: hbase> list_regions 'table_name' hbase> list_regions 'table_name', 'server_name' hbase> list_regions 'table_name', {SERVER_NAME => 'server_name', LOCALITY_THRESHOLD => 0.8} hbase> list_regions 'table_name', {SERVER_NAME => 'server_name', LOCALITY_THRESHOLD => 0.8}, ['SERVER_NAME'] hbase> list_regions 'table_name', {}, ['SERVER_NAME', 'start_key'] hbase> list_regions 'table_name', '', ['SERVER_NAME', 'start_key'] 

Details of its implementation: https://issues.apache.org/jira/browse/HBASE-14925

+2
source share

Hbase has a tool that is used to restore a table and check a sequence called hbase hbck. Although this will not work inside the hbase shell, it can be used to get a list of regions.

The hbase hbck -details <tablename> command can be used to retrieve table information and will contain the required region information.

The output of the above command can be analyzed to obtain information about the region for the desired table.

+1
source share

scan 'hbase: meta', {FILTER => "PrefixFilter ('tableName')", COLUMNS => ['info: regioninfo']}

0
source share

All Articles