Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find the number of regions for a given HBase table?

Tags:

hbase

I thought this is easy, but couldn't find any answer. Hopefully, this can be done using command line tools. Or a Python tool.

Or at least find out how many hfiles?

like image 410
Jian Feng Avatar asked Jan 26 '15 22:01

Jian Feng


People also ask

How do I know my HBase region?

The command hbase hbck -details <tablename> can be used to get the table details and will contain the region information required. The output of the above-mentioned command can be parsed to obtain the region-info for the required table.

What are HBase regions?

In HBase Architecture, a region consists of all the rows between the start key and the end key which are assigned to that Region. And, those Regions which we assign to the nodes in the HBase Cluster, is what we call “Region Servers”. Basically, for the purpose of reads and writes these servers serves the data.

What is the command is used to list of tables available in HBase?

Hey, list is the command that is used to list all the tables in HBase. Given below is the syntax of the list command.


1 Answers

You've got a few options:

1 Via HTTP: http://[your_hbase_master]:60010/table.jsp?name=[your_table]

2 Command-line:

$ hadoop fs -ls /hbase/[your_table]

Found 8 items
-rw-r--r--   3 hbase hbase       1893 2013-05-25 18:03 /hbase/[your_table]/.tableinfo.0000000001
drwxr-xr-x   - hbase hbase          0 2013-05-25 18:03 /hbase/[your_table]/.tmp
drwxr-xr-x   - hbase hbase          0 2014-11-04 06:34 /hbase/[your_table]/045ab87f468ba9e967a0987ca98b7db4
drwxr-xr-x   - hbase hbase          0 2014-11-04 06:34 /hbase/[your_table]/062bc3ef65b9db80a1eeb2c1f4229fdb
drwxr-xr-x   - hbase hbase          0 2014-11-04 06:34 /hbase/[your_table]/0a921049a908dbc929b160210a397632
drwxr-xr-x   - hbase hbase          0 2014-11-04 06:34 /hbase/[your_table]/43a9576bad8845f7d7baacc97882eec6
drwxr-xr-x   - hbase hbase          0 2014-11-04 06:34 /hbase/[your_table]/f492c709d17c4ded150014543f21e362
drwxr-xr-x   - hbase hbase          0 2014-11-04 06:34 /hbase/[your_table]/fa465c6a27023d49893de3c1004efd29

You'll get one directory per region (excluding .tmp y .tableinfo):

3 In JAVA you can use HBaseAdmin.getTableRegions(byte[])

like image 143
Rubén Moraleda Avatar answered Oct 23 '22 02:10

Rubén Moraleda