hadoop rebalance

2023-07-11  本文已影响0人  后知不觉1

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 文件同一目录
上一篇 下一篇

猜你喜欢

热点阅读