Hbase Load Balancing

本文深入探讨了HBase中Balancer的功能及其如何通过内置的balancer特性来平衡Table的regions分布,确保每个region server的负载均衡。详细解释了balancer的工作原理、配置选项以及如何启动、控制balancer,包括手动启动和shell命令的使用。同时,提供了一个实用的场景示例,展示如何利用move命令和API方法灵活地调整region的分配。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

除了load balance的对象是region以外,HBase提供了几个足够好用的接口,有了它们去实现balance一个table的regions就不是问题了!

The master has a built-in feature, called the balancer. By default the balancer runs every five minutes, which is configured by the hbase.balancer.period property. Once the balancer is started it will attempt to equal out the number of assigned regions per region server so that they are within one region of the average number per server. The call first determines a new assignment plan, which describes which regions should be moved where. Then it starts the process of moving the regions by calling the unassign() method of the administrative API iteratively.

The balancer has an upper limit on how long it is allowed to run, which is configured using the hbase.balancer.max.balancing property and defaults to half of the balancer period value, in other words two and a half minutes.

You can control the balancer by means of the balancer switch: either use the shell's balance_switch command to toggle the balancer status between enabled and disabled, or use the balanceSwitch() API method to do the same. When you disable the balancer, it is not run anymore as expected.

The balancer can be explicitly started using the shell's balancer command, or using the API method balancer(). The above time controlled invocation calls this method implicitly. It will determine if there is any work to be done and return true if that is the case. The return value of false means that it was not able to run the balancer, because either it was switched off, there was no work to be done (all is balanced), or something else was prohibiting the process. One example for this is the region in transition list (see the section called “Main Page”): if there is a region currently in transition, the balancer will be skipped.

Instead of relying on the balancer to do its work properly, you can also use the move command and API method to assign regions to other servers. This is useful when you want to control where the regions of a particular table is assigned to. See the section called “Region Hotspotting” for an example.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值