Hadoop常用的操作命令(2)

Hadoop常用的操作命令

列出目錄清單
[root@centos67 ~]# hdfs dfs -ls /

遞歸列出目錄清單
[root@centos67 ~]# hdfs dfs -lsr /

創(chuàng)建目錄
[root@centos67 ~]# hdfs dfs -mkdir /input/test

刪除目錄
[root@centos67 ~]# hdfs dfs -rmr /input/test

創(chuàng)建文件
[root@centos67 ~]# hdfs dfs -touchz /input/test/test.txt

文件重命名
[root@centos67 ~]# hdfs dfs -mv /input/test/test.txt /input/test/test.exe

上傳文件
[root@centos67 ~]# hdfs dfs -put ./test.log /input/test/

下載文件
[root@centos67 ~]# hdfs dfs -get /input/test/test.log ./

查看文件內(nèi)容
[root@centos67 ~]# hdfs dfs -cat /input/test/test.log

刪除文件
[root@centos67 ~]# hdfs dfs -rm /input/test/test.log

復制文件
[root@centos67 ~]# hdfs dfs -cp /input/test/test.log /test.log

統(tǒng)計目錄下的所有文件大小
[root@centos67 ~]# hdfs dfs -du /input

統(tǒng)計整個目錄大小
[root@centos67 ~]# hdfs dfs -dus /input

將指定目錄下所有文件內(nèi)容保存為一個文件,并且下載到本地
[root@centos67 ~]# hdfs dfs -getmerge /input/test ./test.txt

查看文件的最后1KB內(nèi)容
[root@centos67 ~]# hdfs dfs /input/test/test.log

修改文件屬主屬組,可以加-R遞歸
[root@centos67 ~]# hdfs dfs -chown xiaomo:xiaomo /input/test/test.log

修改文件權(quán)限,可以加-R遞歸
[root@centos67 ~]# hdfs dfs -chmod 700 /input/test/test.log

統(tǒng)計當前文件/目錄信息
目錄數(shù)、文件數(shù)、文件大小、文件名/目錄名
[root@centos67 ~]# hdfs dfs -count /input/test/test.log

清空回收站,文件被刪除時,它首先會移到臨時目錄.Trash/中,
當超過延遲時間之后,文件才會被永久刪除 
[root@centos67 ~]# hdfs dfs -expunge

[root@centos67 ~]# hdfs dfs -test /input
對/input進行如下類型的檢查: 
-e 是否存在,如果存在,返回0,否則返回1 
-z 是否為空,如果長度為0,返回0,否則返回1 
-d 是否為目錄,如果為目錄,返回0,否則返回1 

顯示文件內(nèi)容,壓縮文件會解壓
[root@centos67 ~]# hdfs dfs -text /input/test/test.log

查看某個命令的幫助
[root@centos67 ~]# hdfs dfs -help ls
[root@centos67 ~]# hdfs dfs -help touchz

將正在運行的hadoop作業(yè)kill掉
[root@centos67 ~]# hdfs job –kill [job-id]

網(wǎng)站欄目:Hadoop常用的操作命令(2)
分享URL:http://bm7419.com/article10/jdopgo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)網(wǎng)站制作網(wǎng)站制作、外貿(mào)建站、手機網(wǎng)站建設(shè)網(wǎng)站營銷、搜索引擎優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運營