Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase number of regions in an HBase table

Tags:

hadoop

hbase

I have created a table in HBase with a pre split of 8 regions, with HexStringSplit as spliting algorithm. Now I want to increase the number of regions, without destroying the existing table and the data in it. The command with which I created the pre split was

create 't1', 'f1', {NUMREGIONS => 15, SPLITALGO => 'HexStringSplit'}

As it is I cannot execute this command again for increasing the number of regions. Is there any command present for updating the number of regions in an existing table?

like image 811
Raman Avatar asked Apr 13 '15 10:04

Raman


People also ask

How many HBase region Servers are there?

While talking about numbers, it can serve approximately 1,000 regions.

What is the default size of region in HBase?

The recommended maximum region size is 10 - 20 Gb. For HBase clusters running version 0.90. x, the maximum recommended region size is 4 Gb and the default is 256 Mb.


1 Answers

Please notice that the command you provide creates 15 regions, not 8: create 't1', 'f1', {NUMREGIONS => 15, SPLITALGO => 'HexStringSplit'}

You can split regions with the split command:

hbase(main):001:0> split

Here is some help for this command:
Split entire table or pass a region to split individual region.  With the
second parameter, you can specify an explicit split key for the region.
Examples:
    split 'tableName'
    split 'regionName' # format: 'tableName,startKey,id'
    split 'tableName', 'splitKey'
    split 'regionName', 'splitKey'

You should use split 'regionName', 'splitKey' or split 'tableName', 'splitKey', just do not forget to provide the proper SplitKey (the mid one) to each region to ensure even distribution. You can see the current regions at http://your-hbase-master:60010/table.jsp?name=your-table

i.e: if you have a region with StartKey 20000000 and EndKey 40000000 your splitKey would be 30000000, or, if you have a region with StartKey 20000000 and EndKey 30000000 your SplitKey would be 28000000 (remember, it's HEX)

Please try it first with test tables until you feel confident enough with the process.

like image 154
Rubén Moraleda Avatar answered Sep 29 '22 13:09

Rubén Moraleda