【hbase】hbase balance命令走过的坑

转载:https://blog.csdn.net/yuanhaiwn/article/details/82781459

balance主要有四个命令

  • balance_switch
  • balancer
  • balancer_enabled
  • balance_rsgroup(如果开启了rsgroup)

balance_switch

hbase帮助信息:

hbase(main):001:0> help 'balance_switch'
Enable/Disable balancer. Returns previous balancer state.
Examples:

  hbase> balance_switch true
  hbase> balance_switch false

开启或关闭自动 balance, 返回的是之前的状态, 切记, 切记, 返回的是之前的状态, 我就是想当然的以为是当前状态, 结果闹了好多笑话.

这里面还需要注意的一点就是, 帮助信息里面只有 true 和 false, 而自己敲命令的时候, 写完 balance_switch 再随便跟个字母, tab键提示的时候会有一堆命令, 我就用了其中一个命令 balance_switch status, 还以为是查看balance当前状态的, 结果就搞笑了, 一会儿true, 一会儿false

balance_switch status 经测试, 这个命令的意思是将balance状态强制转换为false, 无论之前是true还是false, 返回的是之前的状态, 所以一会儿true, 一会儿false, 所以这个命令很鸡肋, 别乱用, 查看当前状态的命令是balancer_enabled, 后面说

balancer

hbase帮助信息:

hbase(main):027:0* help 'balancer'
Trigger the cluster balancer. Returns true if balancer ran and was able to
tell the region servers to unassign all the regions to balance  (the re-assignment itself is async). 
Otherwise false (Will not run if regions in transition).

这个命令是手动执行一次整个集群的balance, 如果执行成功了就会返回true, 如果因为某些原因没执行成功, 返回false

balancer_enabled

hbase(main):032:0* help 'balancer_enabled'
Query the balancer's state.
Examples:

  hbase> balancer_enabled

查看当前balancer的状态, 这个命令才是真正查询balancer状态的.

balance_rsgroup(如果)

这个命令只有开启了rsgroup才会有

hbase帮助信息:


hbase(main):033:0> help 'balance_rsgroup'
Balance a RegionServer group

Example:

  hbase> balance_rsgroup 'my_group'

应该是手动balance一次分组

总结

对于自动balance来说, 只需要关注三个命令:

  • balance_switch true 开启自动balance

  • balance_switch false 关闭自动balance

  • balancer_enabled 查看自动balance当前状态

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值