HDFS_實戰
  • Introduction
  • hadoop fs / hdfs
  • Filesystem 物件(pyspark 為例)
  • webhdfs
Powered by GitBook
On this page
  • hadoop 指令用起來就像 Linux 指令一般,但他以 Hadoop fs作為指令,而以 Linux 指令作為 args。
  • 常見的如下:
  • 以上範例使用 hadoop fs ,但在新版本裡頭,這已經處於 deplicate 的狀態,後續建議用 hdfs dfs 的指令。

Was this helpful?

hadoop fs / hdfs

hadoop 指令用起來就像 Linux 指令一般,但他以 Hadoop fs作為指令,而以 Linux 指令作為 args。

常見的如下:

  • 顯示目錄下所有檔案 :

hadoop fs -ls <hdfs file path>

  • 取得檔案內容 :

hadoop fs -cat <hdfs file path>

  • 取得 尾部1000 字節內的檔案內容(同 unix 系統的 tail):

hadoop fs -tail <hdfs file path>

  • 搬動檔案 :

hadoop fs -mv <hdfs file path>

  • 複製檔案 :

hadoop fs -cp <hdfs file path from> <hdfs file path destination>

  • 建立路徑 :

hadoop fs -mkdir <hdfs file path>

  • 確認檔案狀態 -e:檔案是否存在, -z: 檔案是否為空, -d: 是否是目錄 :

hadoop fs -test [-ezd]

  • 將本地檔案置放到 hdfs 上

hadoop fs -put <local file> <hdfs file path>

  • 刪除檔案

hadoop -rm [-r] <hdfs file path>

以上範例使用 hadoop fs ,但在新版本裡頭,這已經處於 deplicate 的狀態,後續建議用 hdfs dfs 的指令。

PreviousIntroductionNextFilesystem 物件(pyspark 為例)

Last updated 5 years ago

Was this helpful?