hdfs上傳下載命令「上傳文件到hdfs的命令」

  • 查看
#查看文件信息
hdfs dfs -stat "%o %r" /mytest/1.txt
  • 上傳
#上傳一個文件
hdfs dfs -copyFromLocal /home/gc/1.txt /mytest/
#上傳本test.txt文件到HDFS根目錄,HDFS根目錄須無同名文件,否則「File exists」
hdfs fs -put file:/root/test.txt hdfs:/
#上傳並重命名文件
hdfs fs -put test.txt /test2.txt
#一次上傳多個文件到HDFS路徑
hdfs fs -put test1.txt test2.txt hdfs:/
  • 下載
#下載到本地
hdfs dfs -get /tmp/install.log /home/
  • 刪除
#刪除文件 刪除文件之後 文件被放入回收站trash
hdfs dfs -rm -r –skipTrash /mytest/1.txt
#跳過回收站
hdfs dfs -rm -r –skipTrash /mytest/1.txt
  • 數量
hdfs dfs -count /
  • 修改許可權
hdfs dfs -chmod 777 /1.txt
  • 統計目錄各個文件大小
hdfs dfs -du -h /balance/*/*.zip
  • 多線程導入導出文件
hdfs com.citicbank.hdfs.CrossFileSystemCopyer –r –t 5 file:///home/ hdfs://todo

註:src多個逗號隔開,拷貝成功 命令返回0 失敗為1。

  • Hadoop Native庫生效情況
hadoop checknative -a

原創文章,作者:投稿專員,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/210931.html

(0)
打賞 微信掃一掃 微信掃一掃 支付寶掃一掃 支付寶掃一掃
投稿專員的頭像投稿專員
上一篇 2024-12-08 16:26
下一篇 2024-12-08 16:26

相關推薦

發表回復

登錄後才能評論