◢ <[wiki:NTUOSS160412/Lab3 實作三]> | <[wiki:NTUOSS160412 回課程大綱]> ▲ | <[wiki:NTUOSS160412/Lab5 實作五]> ◣
= 實作四 Lab 4 =
{{{
#!html
HDFS 基本指令操作練習
HDFS in practice (full distributed mode)
}}}
[[PageOutline]]
== Content 1: HDFS Shell 基本操作 ==
== Content 1: Basic HDFS Shell Commands ==
=== 1.1 瀏覽你HDFS目錄 ===
=== 1.1 Browsing Your HDFS Folder ===
{{{
~$ hadoop fs -ls
}}}
=== 1.2 上傳資料到 HDFS 目錄 ===
=== 1.2 Upload Files or Folder to HDFS ===
* 上傳 Upload
{{{
~$ hadoop fs -put ${HOME}/hadoop/conf toHDFS
}}}
* 檢查 Check
{{{
~$ hadoop fs -ls
}}}
=== 1.3 下載 HDFS 的資料到本地目錄 ===
=== 1.3 Download HDFS Files or Folder to Local ===
* 下載 Download
{{{
~$ hadoop fs -get toHDFS fromHDFS
}}}
* 檢查 Check
{{{
~$ ls -al | grep fromHDFS
~$ diff ${HOME}/hadoop/conf fromHDFS/
}}}
=== 1.4 刪除檔案 ===
=== 1.4 Remove Files or Folder ===
{{{
~$ hadoop fs -ls toHDFS/masters
~$ hadoop fs -rm toHDFS/masters
}}}
=== 1.5 直接看檔案 ===
=== 1.5 Browse Files Directly ===
{{{
~$ hadoop fs -ls toHDFS/slaves
~$ hadoop fs -cat toHDFS/slaves
}}}
=== 1.6 更多指令操作 ===
=== 1.6 More Commands -- Help message ===
{{{
~$ hadoop fs
Usage: java FsShell
[-ls ]
[-lsr ]
[-du ]
[-dus ]
[-count[-q] ]
[-mv ]
[-cp ]
[-rm ]
[-rmr ]
[-expunge]
[-put ... ]
[-copyFromLocal ... ]
[-moveFromLocal ... ]
[-get [-ignoreCrc] [-crc] ]
[-getmerge [addnl]]
[-cat ]
[-text ]
[-copyToLocal [-ignoreCrc] [-crc] ]
[-moveToLocal [-crc] ]
[-mkdir ]
[-setrep [-R] [-w] ]
[-touchz ]
[-test -[ezd] ]
[-stat [format] ]
[-tail [-f] ]
[-chmod [-R] PATH...]
[-chown [-R] [OWNER][:[GROUP]] PATH...]
[-chgrp [-R] GROUP PATH...]
[-help [cmd]]
Generic options supported are
-conf specify an application configuration file
-D use value for given property
-fs specify a namenode
-jt specify a job tracker
-files specify comma separated files to be copied to the map reduce cluster
-libjars specify comma separated jar files to include in the classpath.
-archives specify comma separated archives to be unarchived on the compute machines.
The general command line syntax is
hadoop command [genericOptions] [commandOptions]
}}}