优化Hadoop Balancer平衡的速度

版权声明:本文为junehappylove原创文章,未经junehappylove允许不得转载。 https://blog.csdn.net/junehappylove/article/details/78903159

hadoop(2.7.4)集群再用过一段时间后,发现某些节点使用度特别高,而有些这存储较少,这时就考虑对hadoop进行平衡优化了

这时主要考虑两个影响因素参数的调整:
dfs.datanode.max.transfer.threadsdfs.datanode.balance.bandwidthPerSec

  • dfs.datanode.max.transfer.threads
    修改dfs.datanode.max.transfer.threads=4096 (如果运行HBase的话建议为16384),指定用于在DataNode间传输block数据的最大线程数,老版本的对应参数为dfs.datanode.max.xcievers

  • dfs.datanode.balance.bandwidthPerSec
    修改dfs.datanode.balance.bandwidthPerSec=52428800,指定DataNode用于balancer的带宽为50MB,这个根据情况而定,如果交换机性能好点的,完全可以设定100MB,单位是Byte,如果机器的网卡和交换机的带宽有限,可以适当降低该速度,比如10MB,默认是1048576(1MB)。
    hdfs dfsadmin-setBalancerBandwidth 52428800

优化方法

#启动数据均衡,默认阈值为 10%
$HADOOP_HOME/bin/start-balancer.sh

#启动数据均衡,阈值 5%
$HADOOP_HOME/bin/start-balancer.sh –threshold 5

#停止数据均衡
$HADOOP_HOME/bin/stop-balancer.sh

hdfs-site.xml

<property>
    <name>dfs.balance.bandwidthPerSec</name>
    <value>52428800</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>

猜你喜欢

转载自blog.csdn.net/junehappylove/article/details/78903159