[[PageOutline]]
{{{
#!html
實作二: HDFS 指令操作練習
}}}
== 前言 ==
* 此部份接續實做一
== Content 1. 基本操作 ==
=== 1.1 瀏覽你HDFS目錄 ===
{{{
/opt/hadoop$ bin/hadoop fs -ls
}}}
=== 1.2 上傳資料到HDFS目錄 ===
* 上傳
{{{
/opt/hadoop$ bin/hadoop fs -put conf input
}}}
* 檢查
{{{
/opt/hadoop$ bin/hadoop fs -ls
/opt/hadoop$ bin/hadoop fs -ls input
}}}
=== 1.3 下載HDFS的資料到本地目錄 ===
* 下載
{{{
/opt/hadoop$ bin/hadoop fs -get input fromHDFS
}}}
* 檢查
{{{
/opt/hadoop$ ls -al | grep fromHDFS
/opt/hadoop$ ls -al fromHDFS
}}}
=== 1.4 刪除檔案 ===
{{{
/opt/hadoop$ bin/hadoop fs -ls input
/opt/hadoop$ bin/hadoop fs -rm input/masters
}}}
=== 1.5 直接看檔案 ===
{{{
/opt/hadoop$ bin/hadoop fs -ls input
/opt/hadoop$ bin/hadoop fs -cat input/slaves
}}}
=== 1.6 更多指令操作 ===
{{{
hadooper@vPro:/opt/hadoop$ bin/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
bin/hadoop command [genericOptions] [commandOptions]
}}}
== Content 2. 使用網頁Gui瀏覽資訊 ==
* [http://localhost:50030 Map/Reduce Administration]
* [http://localhost:50070 NameNode ]