HDFS balancer配置(可通過CM配置)
dfs.datanode.balance.max.concurrent.moves
並行移動的block數量,默認5
dfs.datanode.balance.bandwidthPerSec
Balance工具所占用的帶寬,默認1048576(1MB)
dfs.balancer.moverThreads
用於執行block移動的線程池大小,默認1000
dfs.balancer.max-size-to-move
每次balance進行迭代的過程最大移動數據量,默認10737418240(10GB)
dfs.balancer.getBlocks.size
獲取block的數量,默認2147483648(2GB)
dfs.balancer.getBlocks.minblock-size
用來平衡的最小block大小,默認10485760(10MB)
dfs.datanode.blockpinning.enabled
hdfs balancer
[-threshold <threshold>]
[-policy <policy>]
[-exclude [-f <hosts-file> | <comma-separated list of hosts>]]
[-include [-f <hosts-file> | <comma-separated list of hosts>]]
[-idleiterations <idleiterations>]
參數說明:
-threshold
某datanode的使用率和整個集群使用率的百分比差值閾值,達到這個閾值就啟動hdfs balancer,取值從1到100,不宜太小,因為在平衡過程中也有數據寫入,太小無法達到平衡
-policy
分為blockpool和datanode,前者是block pool級別的平衡后者是datanode級別的平衡
-exclude
不為空,則不在這些機器上進行平衡
-include
不為空,則僅在這些機器上進行平衡
-idleiterations 最大迭代次數
1.修改dfs.datanode.max.transfer.threads = 4096 (如果運行hbase的話建議為16384),指定用於在DataNode間傳輸block數據的最大線程數,老版本的對應參數為dfs.datanode.max.xcievers
2.修改dfs.datanode.balance.bandwidthPerSec = 31457280 ,指定DataNode用於balancer的帶寬為30MB,這個示情況而定,如果交換機性能好點的,完全可以設定為50MB,單位是Byte,如果機器的網卡和交換機的帶寬有限,可以適當降低該速度,默認是1048576(1MB)
3.修改dfs.datanode.balance.max.concurrent.moves = 50,指定DataNode上同時用於balance待移動block的最大線程個數,這個值默認是5