hadoop rebalance

本文介绍了HDFS数据节点文件均衡分配的两种方式,包括命令行方式(如`hdfsbalancer`)和脚本方式,详细阐述了各自参数、步骤及注意事项,特别提到了使用脚本方式时的缺点和操作建议。
摘要由CSDN通过智能技术生成

hdfs 重新均衡分配文件有两种方式

1. 命令方式

hdfs balancer 参数说明
  [-threshold <threshold>]  #均衡阈值,这次先以20%,均衡后每个datanode在容量相差在20%以内。等待第一次均衡后后面再进行一次10%的均衡,降低集群占用时间
  [-policy <policy>]  # datanode,blockpool 默认datanode,以datanode级别均衡,blockpool文件块均衡(更精准,但更费时),
  [-exclude [-f <hosts-file> | <comma-separated list of hosts>]]  #排出指定机器
  [-include [-f <hosts-file> | <comma-separated list of hosts>]]  #添加指定机器
  [-idleiterations <idleiterations>]   #最大迭代次数

su hdfs -c "hdfs balancer -threshold 20"

缺点:

  1. 需等待结束,也可以后台执行

2. 脚本方式

执行步骤

  1. 修改参数 , bsm中在hdfs模块配置自定义hdfs-site.xml文件新增属性dfs.datanode.balance.max.concurrent.moves=50
  2. 滚动重启datanode
  3. 切换用户su hdfs
  4. 设置每台datanode的带宽
    hdfs dfsadmin -setBalancerBandwidth 73400320
  5. 开始平衡 /opt/hadoop/sbin/start-balancer.sh -threshold 40
  6. 观察日志,跟上面命令返回的out 文件同一目录
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值