5
votes

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?

1

1 Answers

7
votes

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.