Hadoop叢集常用命令

rodertW發表於2019-02-20

 參考:https://blog.csdn.net/cdl2008sky/article/details/79026860 

hadoop fs


hadoop fs -cmd 
cmd: 具體的操作,基本上與UNIX的命令列相同 
hadoop fs -mkdir /user/trunk (建立目錄) 
hadoop fs -ls /user (顯示目錄檔案) 
hadoop fs -lsr /user (遞迴的) 
hadoop fs -put test.txt /user/trunk (複製檔案到/user/trunk 目錄下) 
hadoop fs -put test.txt . (複製到hdfs當前目錄下,首先要建立當前目錄) 

hadoop fs -put test.txt /home/output . (上傳到hdfs) 
hadoop fs -get /user/trunk/test.txt . (複製到本地當前目錄下) 
hadoop fs -cat /user/trunk/test.txt (檢視檔案) 
hadoop fs -touchz /user/new.txt(在hadoop指定目錄下新建一個空檔案) 
hadoop fs -tail /user/trunk/test.txt (檢視最後1000位元組) 
hadoop fs –rm /user/trunk/test.txt (刪除檔案) 
hadoop fs –rmr /user/trunk/test.txt (刪除目錄) 
hadoop fs –cp /user/a.txt /user/b.txt(拷貝檔案) 
hadoop fs –mv /user/test.txt /user/ok.txt 將hadoop上某個檔案重新命名 
hadoop dfs –getmerge /user /home/t 將hadoop指定目錄下所有內容儲存為一個檔案,同時down至本地 
hadoop fs -help ls (檢視ls命令的幫助文件) 
hadoop job –kill [job-id] 將正在執行的hadoop作業kill掉 
hadoop Admin 
hadoop dfsadmin -safemode leave 切換安全模式 
hadoop dfsadmin –report 顯示Datanode列表
 

相關文章