[ビッグデータ] HDFSシェルコマンド

すべてのFSシェルコマンドは、URLパスをパラメーターとして使用します。

HDFSシェルコマンド:

1.開始

start-all

 最初の起動後、fsimageファイルとeditsファイルがnamenodeに自動的に作成されます

2.ヘルプマニュアル

hdfs dfs -help

3.カタログ情報を表示します

hdfs dfs -ls /      //  /代表根目录
hdfs dfs -ls -R  // -r为递归显示

4.ファイルを追加します

hdfs dfs -mkdir /test
hdfs dfs -mkdir -p /test/imput   // -p代表递归创建,子目录文件

5.ファイルをローカルからHDFSにコピーします

hdfs dfs -copyFromLocal ./start-all.cmd  /test/imput  

//将当前目录的start-all.cmd 复制到/test/imput中

6.ファイルをHDFSにアップロードします

hdsf dfs -put ./start-all.cmd /test/imput  

//会报错文件已经存在,也验证了hdfs系统的只能一次写入,多次读取的特性
//但命令格式正确

7.HDFSからファイルを取得します

hdfs dfs -get /test/imput/start-all.cmd  ./star-all.cmd.back
hdfs dfs -copyTolocal /test/imput/start-all.cmd  ./star-all.cmd.back

8.テキストの内容を表示します

hdfs dfs -cat /test/imput/start-all.cmd  
//显示全部内容
hdfs dfs -tail /test/imput/start-all.cmd 
//显示一个文件的末尾
hdfs dfs -text /test/imput/start-all.cmd 
//以字符形式打印一个文件的内容

9.ファイルを削除します

hdfs dfs -rm -f /test/imput/start-all.cmd 
//-f代表强制删除

10.フォルダを削除します

hdfs dfs -rm -r /test/imput/
//-r代表递归删除

11.hdfsの1つのパスからhdfsの別のパスにコピーします

hdfs dfs -cp /test/imput/start-all.cmd  /test/start-all.cmd  

12.システム情報

hdfs dfs -df -h  /
//统计文件系统的可用空间信息
//-h
hdfs dfs -du -s -h /test
//统计文件夹的大小信息
hdfs dfs -cout /
//统计一个指定目录下的文件节点数量

 

 

 

 

 

 

 

おすすめ

転載: blog.csdn.net/Qmilumilu/article/details/104644645