Hadoop Balance

一、hadoop balance工具的用法:

    启动balance:

      bin/start-balancer.sh -threshold 5

    停止balance:

      bin/stop-balancer.sh

二、影响hadoop balance工具的几个参数:

    -threshold默认设置:10,参数取值范围:0-100,参数含义:判断集群是否平衡的目标参数,每一个datanode存储使用率和集群总存储使用率的差值都应该小于这个阀值,理论上,该参数设置的越小,整个集群就越平衡,但是线上环境中,hadoop集群在进行balance时,还在并发的进行数据的吸入和删除,所以有可能无法到达设定的平衡参数值。

    dfs.balance.bandwidthPerSec默认设置:1048576(1M/S),参数含义:设置balance工具的运行中所能占用的带宽,设置的过大可能会造成mapred运行缓慢。

设置该参数需要修改hdfs-site.xml文件:

<property> 
<name>dfs.balance.bandwidthPerSec</name> 
<value>20971520</value> 
<description>  Specifies the maximum bandwidth that each datanode can utilize for the balancing purpose in term of the number of bytes per second. </description> 
</property>

上面是设置传输速率为20M/S。

三、hadoop balance工具其它特点:

    balance工具的运行过程中,迭代的将文件块从高使用率的datanode移动到低使用率的datanode上,每一个迭代过程中移动的数据量不超过下面两个值的较小者:10G或者指定阀值*容量,且每次迭代不超过20分钟。每次迭代结束后,balance工具将更新该datanode的文件块分布情况。

原文地址:https://www.cnblogs.com/Richardzhu/p/3623323.html