Hadoop常用的操作命令(2)-創(chuàng)新互聯(lián)

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

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

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

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

將指定目錄下所有文件內(nèi)容保存為一個(gè)文件,并且下載到本地
[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)計(jì)當(dāng)前文件/目錄信息
目錄數(shù)、文件數(shù)、文件大小、文件名/目錄名
[root@centos67 ~]# hdfs dfs -count /input/test/test.log

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

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

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

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

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

超過十多年行業(yè)經(jīng)驗(yàn),技術(shù)領(lǐng)先,服務(wù)至上的經(jīng)營(yíng)模式,全靠網(wǎng)絡(luò)和口碑獲得客戶,為自己降低成本,也就是為客戶降低成本。到目前業(yè)務(wù)范圍包括了:網(wǎng)站建設(shè)、成都做網(wǎng)站,成都網(wǎng)站推廣,成都網(wǎng)站優(yōu)化,整體網(wǎng)絡(luò)托管,微信平臺(tái)小程序開發(fā),微信開發(fā),手機(jī)APP定制開發(fā),同時(shí)也可以讓客戶的網(wǎng)站和網(wǎng)絡(luò)營(yíng)銷和我們一樣獲得訂單和生意!

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

當(dāng)前名稱:Hadoop常用的操作命令(2)-創(chuàng)新互聯(lián)
網(wǎng)頁(yè)鏈接:http://muchs.cn/article26/djjscg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃電子商務(wù)、搜索引擎優(yōu)化域名注冊(cè)、手機(jī)網(wǎng)站建設(shè)、云服務(wù)器

廣告

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

外貿(mào)網(wǎng)站建設(shè)