1.scp實現兩個遠端主機之間的檔案複製
scp -r hello.txt root@hadoop103:/user/atguigu/hello.txt
// 推 push
scp -r root@hadoop103:/user/atguigu/hello.txt hello.txt
// 拉 pull
scp -r root@hadoop103:/user/atguigu/hello.txt
root@hadoop104:/user/atguigu
//是通過本地主機中轉實現兩個遠端主機的檔案複製;如果在兩個遠端主機之間ssh沒有配置的情況下可以使用該方式。
2.採用distcp命令實現兩個hadoop集群之間的遞迴資料複製
3.案例實操
(1)需要啟動yarn程序
[atguigu@hadoop102 hadoop-2.7.2]$ start-yarn.sh
(2)歸檔檔案
把/user/atguigu/input目錄裡面的所有檔案歸檔成乙個叫input.har的歸檔檔案,並把歸檔後檔案儲存到/user/atguigu/output路徑下。
[atguigu@hadoop102 hadoop-2.7.2]$ bin/hadoop archive -archivename input.har –p /user/atguigu/input /user/atguigu/output(3)檢視
歸檔
[atguigu@hadoop102 hadoop-2.7.2]$ hadoop fs -lsr /user/atguigu/output/input.har(4)解[atguigu@hadoop102 hadoop-2.7.2]$ hadoop fs -lsr har://
/user/atguigu/output/input.har
歸檔檔案
[atguigu@hadoop102 hadoop-2.7.2]$ hadoop fs -cp har://開啟**站功能,可以將刪除的檔案在不超時的情況下,恢復原資料,起到防止誤刪除、備份等作用。/ user/atguigu/output/input.har/* /user/atguigu
1.**站引數設定及工作機制
2.啟用
**站修改core-site.xml,配置垃圾**時間
為1分鐘。
fs.trash.interval3.檢視**站1
**站在集群中的路徑:/user/atguigu/.trash/….
4.修改訪問垃圾**站使用者名稱
進入垃圾**站使用者名稱,預設是dr.who,修改為atguigu使用者
5. 通過程式刪除的檔案不會經過**站,需要呼叫movetotrash()才
進入**站
trash trash = new trash(conf);
trash.movetotrash(path);
6 恢復**站資料
[atguigu@hadoop102 hadoop-2.7.2]$ hadoop fs -mv7 清空**站/user/atguigu/.trash/current/user/atguigu/input /user/atguigu/input
2.案例實操
(1)開啟/禁用
指定目錄的快照功能
[atguigu@hadoop102 hadoop-2.7.2]$ hdfs dfsadmin -allowsnapshot /user/atguigu/input(2)對[atguigu@hadoop102 hadoop-2.7.2]$ hdfs dfsadmin -disallowsnapshot /user/atguigu/input
目錄建立快照
[atguigu@hadoop102 hadoop-2.7.2]$ hdfs dfs -createsnapshot /user/atguigu/input通過web訪問hdfs://hadoop102:50070/user/atguigu/input/.snapshot/s…..// 快照
和原始檔使用相同資料
[atguigu@hadoop102 hadoop-2.7.2]$ hdfs dfs -lsr /user/atguigu/input/.snapshot/(3)指定
名稱建立快照
[atguigu@hadoop102 hadoop-2.7.2]$ hdfs dfs -createsnapshot /user/atguigu/input miao170508(4)重新命名
快照
[atguigu@hadoop102 hadoop-2.7.2]$ hdfs dfs -renamesnapshot /user/atguigu/input/ miao170508 atguigu170508(5)列出
當前使用者所有可快照目錄
[atguigu@hadoop102 hadoop-2.7.2]$ hdfs lssnapshottabledir(6)比較
兩個快照目錄的不同之處
[atguigu@hadoop102 hadoop-2.7.2]$ hdfs snapshotdiff(7)恢復/user/atguigu/input/ . .snapshot/atguigu170508
快照
[atguigu@hadoop102 hadoop-2.7.2]$ hdfs dfs -cp/user/atguigu/input/.snapshot/s20170708-134303.027 /user
大資料小白系列 HDFS 2
這裡是大資料小白系列,這是本系列的第二篇,介紹一下hdfs中secondarynamenode 單點失敗 spof 以及高可用 ha 等概念。首先,在啟動的時候,將磁碟中的元資料檔案讀取到記憶體,後續所有變化將被直接寫入記憶體,同時被寫入乙個叫edit log的磁碟檔案。如果你熟悉關係型資料庫,這個...
Hadoop基礎 HDFS結構
1 簡述hdfs的特點以及優點缺點。hdfs的優點 1 支援超大檔案的儲存 2 支援流式檔案訪問。3 執行於廉價的商用機器集群。hdfs的缺點 1 不適合低延遲資料訪問 2 無法高效儲存大量小檔案 3 不支援多使用者寫入及任意修改檔案。2 簡述namenode,datanode,secondary ...
hadoop學習2 HDFS操作
課程內容為hdfs的基本操作和hue頁面的使用主要是hdfs的基本命令。對於檔案的操作,命令與linux的類似,但是要在前面加上hadoop fs 其基本的格式為 hadoop fs 檢視檔案 hadoop fs ls 可以看到data資料夾下只有乙個資料夾test 建立路徑 hadoop fs m...