在線上的hadoop集羣運維過程中,hadoop 的balance工具通常用於平衡hadoop集羣中各datanode中的文件塊分佈,以避免出現部分datanode磁盤佔用率高的問題(這問題也很有可能導致該節點CPU使用率較其他服務器高)。
可能的原因:
1. 突然磁盤使用率變高而文件塊數並沒有很大的增加,極有可能是出現某個用戶的作業產生大量大的文件,排查刪除掉就課可以。注意將trash中的也要刪除掉
2.也有可能是長期使用造成的,請查清楚每個節點的負載情況,進行排序,然後處理。
下付balance工具的一些說明,可以參考http://blog.csdn.net/azhao_dn/article/details/7741666
1) hadoop balance工具的用法:
- To start:
- bin/start-balancer.sh [-threshold <threshold>]
- Example: bin/ start-balancer.sh
- start the balancer with a default threshold of 10%
- bin/ start-balancer.sh -threshold 5
- start the balancer with a threshold of 5%
- To stop:
- bin/ stop-balancer.sh
-threshold 默認設置:10,參數取值範圍:0-100,參數含義:判斷集羣是否平衡的目標參數,每一個 datanode 存儲使用率和集羣總存儲使用率的差值都應該小於這個閥值 ,理論上,該參數設置的越小,整個集羣就越平衡,但是在線上環境中,hadoop集羣在進行balance時,還在併發的進行數據的寫入和刪除,所以有可能無法到達設定的平衡參數值。
dfs.balance.bandwidthPerSec 默認設置:1048576(1 M/S),參數含義:設置balance工具在運行中所能佔用的帶寬,設置的過大可能會造成mapred運行緩慢
3)hadoop balance工具其他特點:
balance工具在運行過程中,迭代的將文件塊從高使用率的datanode移動到低使用率的datanode上,每一個迭代過程中移動的數據量不超過下面兩個值的較小者:10G或者指定閥值*容量,且每次迭代不超過20分鐘。每次迭代結束後,balance工具將更新該datanode的文件塊分佈情況。以下爲官方文檔英文描述:
- The tool moves blocks from highly utilized datanodes to poorly utilized datanodes
- iteratively. In each iteration a datanode moves or receives no more than the lesser of 10G
- bytes or the threshold fraction of its capacity. Each iteration runs no more than 20
- minutes. At the end of each iteration, the balancer obtains updated datanodes information
- from the namenode.
參考資料:
http://blog.csdn.net/azhao_dn/article/details/7741666