中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

hdfs使用手冊balancer(數據平衡)命令詳解

發布時間:2020-08-05 17:54:33 來源:網絡 閱讀:1307 作者:馬吉輝 欄目:大數據

2019/1/21 星期一


2.3.1. balancer
運行一個集群平衡工具。管理員可以通過按Ctrl+C鍵停止再平衡過程。
數據平衡的需求
HDFS數據不平衡的原因
1.某個DataNode機器內硬盤存儲達到飽和值。
2.集群內新增、刪除節點。
數據不平衡的影響
1.Map任務可能會被分配給沒有存儲數據的機器,結果是不能實現本地計算,最終會導致網絡
帶寬的消耗。
2.當一些數據節點數據完全滿載時,新的數據塊只會被存放在有空余數據的節點機器上,造成了并行讀取的可能性。
數據平衡過程的要求
1.數據平衡不會導致數據塊減少、數據塊備份丟失。
2.管理員可以中止數據平衡進程。
3.每次數據塊移動的大小應該是可控的,這樣可以放置阻塞網絡。
4.namenode不會因為數據平衡服務而導致過于繁忙。
數據自動平衡原理
由于使用了平衡算法,導致數據平衡是一個迭代的、周而復始的過程。每一次迭代的最終目的
是讓高負載的機器能夠降低數據負載,所以數據平衡會最大程度上地使用網絡帶寬。

數據平衡流程交互圖
hdfs使用手冊balancer(數據平衡)命令詳解

步驟分析如下:

1、數據均衡服務(Rebalancing Server)首先要求 NameNode 生成 DataNode 數據分布分析報告,獲取每個DataNode磁盤使用情況
2、Rebalancing Server匯總需要移動的數據分布情況,計算具體數據塊遷移路線圖。數據塊遷移路線圖,確保網絡內最短路徑
3、開始數據塊遷移任務,Proxy Source Data Node復制一塊需要移動數據塊
4、將復制的數據塊復制到目標DataNode上
5、刪除原始數據塊
6、目標DataNode向Proxy Source Data Node確認該數據塊遷移完成
7、Proxy Source Data Node向Rebalancing Server確認本次數據塊遷移完成。然后繼續執行這個過程,直至集群達到數據均衡標準

實際操作
1.切換到hdfs用戶

[root@hadoop-master ~]# su - hdfs
2.查看當前的數據分布情況
[hdfs@hadoop-master ~]$ hdfs dfsadmin -report > /tmp/bq
[hdfs@hadoop-master ~]$ cat /tmp/bq 
Configured Capacity: 273287419086 (254.52 GB)
Present Capacity: 209643254756 (195.25 GB)
DFS Remaining: 199579415524 (185.87 GB)
DFS Used: 10063839232 (9.37 GB)
DFS Used%: 4.80%
Under replicated blocks: 0
Blocks with corrupt replicas: 0
Missing blocks: 0
Missing blocks (with replication factor 1): 0

配置容量:273287419086(254.52 GB)
現有容量:209643254756(195.25 GB)
DFS剩余:199579415524(185.87 GB)
使用的DFS:10063839232(9.37 GB)
使用DFS%:4.80%
在復制塊下:0
具有損壞副本的塊:0
缺少塊:0
缺少塊(復制因子1):0
-------------------------------------------------
Live datanodes (3):  實時數據節點(3):

Name: 192.168.0.117:50010 (hadoop-node01)
Hostname: hadoop-node01
Rack: /default
Decommission Status : Normal
Configured Capacity: 91095806362 (84.84 GB)
DFS Used: 3354603520 (3.12 GB)
Non DFS Used: 12246245786 (11.41 GB)
DFS Remaining: 69809631564 (65.02 GB)
DFS Used%: 3.68%
DFS Remaining%: 76.63%
Configured Cache Capacity: 4294967296 (4 GB)
Cache Used: 0 (0 B)
Cache Remaining: 4294967296 (4 GB)
Cache Used%: 0.00%
Cache Remaining%: 100.00%
Xceivers: 10
Last contact: Mon Jan 21 10:45:24 CST 2019

名稱:192.168.0.117:50010(hadoop-node01)
主機名:hadoop-node01
機架:/默認
退役狀態:正常
配置容量:91095806362(84.84 GB)
使用的DFS:3354603520(3.12 GB)
非DFS使用:12246245786(11.41 GB)
剩余DFS:69809631564(65.02 GB)
使用DFS%:3.68%
DFS剩余%:76.63%
配置的緩存容量:4294967296(4 GB)
使用的緩存:0(0 B)
剩余高速緩存:4294967296(4 GB)
使用的緩存%:0.00%
剩余高速緩存%:100.00%
Xceivers:10
最后聯系人:Mon Jan 21 10:45:24 CST 2019

Name: 192.168.0.118:50010 (hadoop-master)
Hostname: hadoop-master
Rack: /default
Decommission Status : Normal
Configured Capacity: 91095806362 (84.84 GB)
DFS Used: 3354632192 (3.12 GB)
Non DFS Used: 29517959578 (27.49 GB)
DFS Remaining: 52537889100 (48.93 GB)
DFS Used%: 3.68%
DFS Remaining%: 57.67%
Configured Cache Capacity: 4294967296 (4 GB)
Cache Used: 0 (0 B)
Cache Remaining: 4294967296 (4 GB)
Cache Used%: 0.00%
Cache Remaining%: 100.00%
Xceivers: 10
Last contact: Mon Jan 21 10:45:24 CST 2019

Name: 192.168.0.121:50010 (hadoop-node02)
Hostname: hadoop-node02
Rack: /default
Decommission Status : Normal
Configured Capacity: 91095806362 (84.84 GB)
DFS Used: 3354603520 (3.12 GB)
Non DFS Used: 4823982490 (4.49 GB)
DFS Remaining: 77231894860 (71.93 GB)
DFS Used%: 3.68%
DFS Remaining%: 84.78%
Configured Cache Capacity: 4294967296 (4 GB)
Cache Used: 0 (0 B)
Cache Remaining: 4294967296 (4 GB)
Cache Used%: 0.00%
Cache Remaining%: 100.00%
Xceivers: 10
Last contact: Mon Jan 21 10:45:24 CST 2019

3.使用命令平衡數據
[hdfs@hadoop-master ~]$ hdfs balancer
19/01/21 10:49:19 INFO balancer.Balancer: namenodes  = [hdfs://vg-cdh-test]
19/01/21 10:49:19 INFO balancer.Balancer: parameters = Balancer.Parameters [BalancingPolicy.Node, threshold = 10.0, max idle iteration = 5, number of nodes to be excluded = 0, number of nodes to be included = 0, run during upgrade = false]
Time Stamp               Iteration#  Bytes Already Moved  Bytes Left To Move  Bytes Being Moved
19/01/21 10:49:21 INFO net.NetworkTopology: Adding a new node: /default/192.168.0.117:50010
19/01/21 10:49:21 INFO net.NetworkTopology: Adding a new node: /default/192.168.0.118:50010
19/01/21 10:49:21 INFO net.NetworkTopology: Adding a new node: /default/192.168.0.121:50010
19/01/21 10:49:21 INFO balancer.Balancer: 0 over-utilized: []
19/01/21 10:49:21 INFO balancer.Balancer: 0 underutilized: []
The cluster is balanced. Exiting...
2019-1-21 10:49:21                0                  0 B                 0 B               -1 B
2019-1-21 10:49:21       Balancing took 2.738 seconds
4.查看數據平衡后的數據分布情況
[hdfs@hadoop-master ~]$ hdfs dfsadmin -report > /tmp/bh
[hdfs@hadoop-master ~]$ cat /tmp/bh
Configured Capacity: 273287419086 (254.52 GB)
Present Capacity: 209660106924 (195.26 GB)
DFS Remaining: 199596266468 (185.89 GB)
DFS Used: 10063840456 (9.37 GB)
DFS Used%: 4.80%
Under replicated blocks: 0
Blocks with corrupt replicas: 0
Missing blocks: 0
Missing blocks (with replication factor 1): 0

-------------------------------------------------
Live datanodes (3):

Name: 192.168.0.117:50010 (hadoop-node01)
Hostname: hadoop-node01
Rack: /default
Decommission Status : Normal
Configured Capacity: 91095806362 (84.84 GB)
DFS Used: 3354603928 (3.12 GB)
Non DFS Used: 12246663170 (11.41 GB)
DFS Remaining: 69809213772 (65.01 GB)
DFS Used%: 3.68%
DFS Remaining%: 76.63%
Configured Cache Capacity: 4294967296 (4 GB)
Cache Used: 0 (0 B)
Cache Remaining: 4294967296 (4 GB)
Cache Used%: 0.00%
Cache Remaining%: 100.00%
Xceivers: 10
Last contact: Mon Jan 21 10:50:10 CST 2019

Name: 192.168.0.118:50010 (hadoop-master)
Hostname: hadoop-master
Rack: /default
Decommission Status : Normal
Configured Capacity: 91095806362 (84.84 GB)
DFS Used: 3354632600 (3.12 GB)
Non DFS Used: 29501419522 (27.48 GB)
DFS Remaining: 52554428748 (48.95 GB)
DFS Used%: 3.68%
DFS Remaining%: 57.69%
Configured Cache Capacity: 4294967296 (4 GB)
Cache Used: 0 (0 B)
Cache Remaining: 4294967296 (4 GB)
Cache Used%: 0.00%
Cache Remaining%: 100.00%
Xceivers: 10
Last contact: Mon Jan 21 10:50:10 CST 2019

Name: 192.168.0.121:50010 (hadoop-node02)
Hostname: hadoop-node02
Rack: /default
Decommission Status : Normal
Configured Capacity: 91095806362 (84.84 GB)
DFS Used: 3354603928 (3.12 GB)
Non DFS Used: 4823252994 (4.49 GB)
DFS Remaining: 77232623948 (71.93 GB)
DFS Used%: 3.68%
DFS Remaining%: 84.78%
Configured Cache Capacity: 4294967296 (4 GB)
Cache Used: 0 (0 B)
Cache Remaining: 4294967296 (4 GB)
Cache Used%: 0.00%
Cache Remaining%: 100.00%
Xceivers: 10
Last contact: Mon Jan 21 10:50:10 CST 2019
————————————————————————————————————————————————————————————————————————————————
5.對比數據平衡前后的報告信息
[hdfs@hadoop-master ~]$ diff /tmp/bq /tmp/bh
2,4c2,4
< Present Capacity: 209643254756 (195.25 GB)
< DFS Remaining: 199579415524 (185.87 GB)
< DFS Used: 10063839232 (9.37 GB)
---
> Present Capacity: 209660106924 (195.26 GB)
> DFS Remaining: 199596266468 (185.89 GB)
> DFS Used: 10063840456 (9.37 GB)
19,21c19,21
< DFS Used: 3354603520 (3.12 GB)
< Non DFS Used: 12246245786 (11.41 GB)
< DFS Remaining: 69809631564 (65.02 GB)
---
> DFS Used: 3354603928 (3.12 GB)
> Non DFS Used: 12246663170 (11.41 GB)
> DFS Remaining: 69809213772 (65.01 GB)
30c30
< Last contact: Mon Jan 21 10:45:24 CST 2019
---
> Last contact: Mon Jan 21 10:50:10 CST 2019
38,40c38,40
< DFS Used: 3354632192 (3.12 GB)
< Non DFS Used: 29517959578 (27.49 GB)
< DFS Remaining: 52537889100 (48.93 GB)
---
> DFS Used: 3354632600 (3.12 GB)
> Non DFS Used: 29501419522 (27.48 GB)
> DFS Remaining: 52554428748 (48.95 GB)
42c42
< DFS Remaining%: 57.67%
---
> DFS Remaining%: 57.69%
49c49
< Last contact: Mon Jan 21 10:45:24 CST 2019
---
> Last contact: Mon Jan 21 10:50:10 CST 2019
57,59c57,59
< DFS Used: 3354603520 (3.12 GB)
< Non DFS Used: 4823982490 (4.49 GB)
< DFS Remaining: 77231894860 (71.93 GB)
---
> DFS Used: 3354603928 (3.12 GB)
> Non DFS Used: 4823252994 (4.49 GB)
> DFS Remaining: 77232623948 (71.93 GB)
68c68
< Last contact: Mon Jan 21 10:45:24 CST 2019
---
> Last contact: Mon Jan 21 10:50:10 CST 2019
在生產上實際的操作如下:
hdfs dfsadmin -fs hdfs://uhadoop-mzwc2w-master2:8020 -setBalancerBandwidth 3145728000
[hadoop@uhadoop-mzwc2w-master1 ~]$ hdfs dfsadmin -fs hdfs://uhadoop-mzwc2w-master2:8020 -setBalancerBandwidth 3145728000
Balancer bandwidth is set to 3145728000
[hadoop@uhadoop-mzwc2w-master1 ~]$ hdfs dfsadmin -fs hdfs://uhadoop-mzwc2w-master1:8020 -setBalancerBandwidth 3145728000
Balancer bandwidth is set to 3145728000
//一定要2個節點namenode節點 master1 master2 都要執行 

在生產上2019/7/22 星期一 我在master1 和master2 都執行balancer 
[hadoop@uhadoop-mzwc2w-master1 majihui0718]$ nohup hdfs balancer > balancer.log & //生產上這樣處理
[hadoop@uhadoop-mzwc2w-master2 majihui0722]$ pwd
/home/hadoop/majihui0722
[hadoop@uhadoop-mzwc2w-master2 majihui0722]$ ll
total 596
-rw-r--r-- 1 hadoop wheel 609794 Jul 22 14:11 balancer.log

我們是1000M的網,給300M的帶寬用于datanode的數據balance

參考鏈接
https://www.cnblogs.com/qingyunzong/p/8535995.html
參考鏈接
HDFS balance策略詳解 https://www.jianshu.com/p/f7c1cd476601

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

祁阳县| 潼关县| 丰顺县| 繁峙县| 铁岭县| 神池县| 平南县| 牙克石市| 久治县| 许昌市| 河北省| 江口县| 阜宁县| 曲靖市| 西和县| 尉氏县| 岑溪市| 澄江县| 合作市| 中宁县| 台东县| 曲阳县| 洪泽县| 绥宁县| 宜宾市| 南阳市| 松溪县| 北安市| 汤原县| 广西| 五指山市| 屯昌县| 衡山县| 元江| 法库县| 西城区| 兰州市| 绵竹市| 台中县| 日照市| 佛坪县|