HBase Online Merge
CDH 5 supports online merging of regions. HBase splits big regions automatically but does not support merging small regions automatically. To complete an online merge of two regions of a table, you need to use the HBase shell to issue the online merge command. By default, both regions to be merged should be neighbors, that is, one end key of a region should be the start key of the other region. Even though you can "force" merge any two regions of the same table, this is not recommended as it could create overlaps.
The Master and RegionServer both participate in online merges. When the request to merge is sent to the Master, the Master moves the regions to be merged to the same RegionServer, usually the one where the region with the higher load resides. The Master then requests the RegionServer to merge the two regions. The RegionServer processes this request locally. Once the two regions are merged, the new region will be online and available for server requests while the old regions will be taken offline.
For merging two consecutive regions use the following command:
hbase> merge_region 'ENCODED_REGIONNAME', 'ENCODED_REGIONNAME'
For merging regions that are not adjacent, passing true as the third parameter will force the merge.
hbase> merge_region 'ENCODED_REGIONNAME', 'ENCODED_REGIONNAME', true