I run CDH 5.2 and have an odd problem. I am running HBase with seven RegionServers and 1200 Regions, but the bulk of the Regions are running on two or three of the RegionServers instead of balancing across all Regions. This leads to a problem where two of the RegionServers run out of memory and fail the Java processes, while the other RegionServers sit idle. Is there a command I can run to balance the Regions across all RegionServers?
I am just sharing the relevant part of the linked docs, as they contain the instructions on how to enable the hbase balancer via hbase shell:
It is assumed that the Region Load Balancer is disabled while the graceful_stop script runs (otherwise the balancer and the decommission script will end up fighting over region deployments). Use the shell to disable the balancer:
hbase(main):001:0> balance_switch false true 0 row(s) in 0.3590 seconds
This turns the balancer OFF. To reenable, do:
hbase(main):001:0> balance_switch true false 0 row(s) in 0.3590 seconds
The graceful_stop will check the balancer and if enabled, will turn it off before it goes to work. If it exits prematurely because of error, it will not have reset the balancer. Hence, it is better to manage the balancer apart from graceful_stopreenabling it after you are done w/ graceful_stop.