常用 HDFS的Shell 命令列客戶端 操作

2021-10-09 16:09:09 字數 1246 閱讀 9301

2、常用命令

hadoop 安裝目錄 bin 目錄下的 hadoop 指令碼是最基礎的集群管理指令碼,使用者可以通過該指令碼完成各種功能,如 hdfs 檔案管理、mapreduce 作業管理等。

hadoop fs -mkdir /user/test			#建立hdfs目錄/user/test

hadoop fs -cp /abc/** /123/abc #從 hdfs 的乙個路徑複製到 hdfs 的另外乙個路徑

hadoop fs -put test.txt /user/test		#上傳檔案test.txt檔案至/user/test/

hadoop fs -get /user/test/test.txt #獲取/user/test/test.txt檔案

hadoop fs -copytolocal /abc/1.txt desktop/data/《重新命名》

#-movefromlocal 從本地剪下檔案到hdfs

hadoop fs -movefromlocal /home/theone/desktop/software/data/1.txt /abc

#-movetolocal 從hdfs剪下檔案到本地

hadoop fs -movetolocal /abc/1.txt /home/theone/desktop/software/data/ # 《命令無法實現,資料不能被修改》

hadoop fs -getmerge /abc/*.txt ./all.txt

hadoop fs -cat /user/test/test.txt		#檢視/user/test/test.txt檔案內容

hadoop fs -tail /user/test/test.txt #檢視/user/test/test.txt檔案內容最後1000行

hadoop fs -ls /user		#檢視/user目錄下的目錄和檔案

hadoop fs -lsr /user #遞迴檢視/user目錄下的目錄和檔案

hadoop fs -rm /user/test/test.txt       #刪除/user/test/test.txt檔案

hadoop fs -rm -r /user/test/ #刪除/user/test目錄

hadoop fs -help

hadoop fs -help ls

hdfs命令列shell操作

bin hadoop fs 具體命令 or bin hdfs dfs 具體命令 兩個是完全相同的。hdfs的操作可以分為三類 1.本地 hdfs 上傳 3.hdfs hdfs hdfs內部操作 一 上傳 1.put 從本地檔案系統中拷貝檔案到 hdfs 路徑去 put2.txt 本地檔案路徑,上傳到...

shell命令列常用快捷命令

了解一些shell命令列操作命令,可以提高工作效率,一下列出了常用的幾個快捷命令 ctrl a 移動到當前行首 對應鍵盤home鍵 ctrl e 移動到當前行尾 對應鍵盤end鍵 ctrl l 清屏,並在螢幕最上面開始乙個新行 ctrl r 在歷史命令中查詢 有時history比較多時,想找乙個比較...

HDFS命令列介面

fs.default.name 這個屬性設定hadoop預設的檔案系統。引數是個uri的格式。例如 hdfs 192.168.10.4 54310。namenode程序按照這個引數啟動ipc服務。ipc是hadoop跨機器通訊機制,通過ipc客戶端直接呼叫伺服器類的某個方法,遮蔽了複雜的socket...