HDFS常用操作

2021-08-28 22:10:32 字數 937 閱讀 3823

上傳檔案

hdfs dfs -put src… dest (從本地的src位置上傳到hdfs的dest位置,src可以有多個,空格隔開)

複製檔案

hdfs dfs -copyfromlocal src… dest (複製檔案,從src位置複製到dest 位置,src可以有多個,空格隔開)

移動檔案(剪下)

hdfs dfs -movefromlocal src… dest (移動檔案,從src移動到dest位置)

建立新目錄

hdfs dfs -mkdir /test

hdfs dfs -mkdir -p /test/luo (級聯建立)

往檔案中追加資訊

檢視檔案內容

hdfs dfs -cat /test/t1 (檢視/test資料夾下的t1檔案)

更改檔案的屬組

hdfs dfs -chgrp nb /test/t1 (把t1 檔案的屬組改為nb)

hdfs dfs -r -chgrp nb /test/t1 (遞迴修改)

更改檔案的許可權

hdfs dfs -chmod -r 777 /luo (/luo的許可權改為777)

更改檔案的屬主及屬組

hdfs dfs -chown -r luo:zzz /luo

將hdfs上的檔案複製到本地

hdfs dfs -copytolocal /t1 ./

檢視檔案系統的磁碟空間

hdfs dfs -df -h /

Hdfs常用操作

本文記錄一下hdfs的一些常用指令 如果我們想要上傳檔案到hdfs,可以執行如下指令 hadoop dfs put 本地檔案的路徑 hdfs的路徑例如 hadoop dfs put home spark hadoop datasource inte ce access log 20160829 da...

HDFS常用操作

命令格式 hdfs dfs mkdir 舉例 在hdfs上已有資料夾data下面簡歷乙個新的資料夾zuo hdfs dfs mkdir data zuo 命令格式 hdfs dfs ls 列出檔案路徑下的檔案 hdfs dfs ls a 列出檔案路徑下所有的檔案,包括隱藏檔案 hdfs dfs ls...

HDFS常用操作

hdfs dfs ls hdfs dfs put file file example hdfs dfs put test1 input test 把當前本地目錄下的test1檔案上傳到hdfs input目錄下,並命名為testhdfs dfs get file file or dir local ...