| Version 4 (modified by waue, 17 years ago) (diff) |
|---|
實作二: 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 <path>]
[-lsr <path>]
[-du <path>]
[-dus <path>]
[-count[-q] <path>]
[-mv <src> <dst>]
[-cp <src> <dst>]
[-rm <path>]
[-rmr <path>]
[-expunge]
[-put <localsrc> ... <dst>]
[-copyFromLocal <localsrc> ... <dst>]
[-moveFromLocal <localsrc> ... <dst>]
[-get [-ignoreCrc] [-crc] <src> <localdst>]
[-getmerge <src> <localdst> [addnl]]
[-cat <src>]
[-text <src>]
[-copyToLocal [-ignoreCrc] [-crc] <src> <localdst>]
[-moveToLocal [-crc] <src> <localdst>]
[-mkdir <path>]
[-setrep [-R] [-w] <rep> <path/file>]
[-touchz <path>]
[-test -[ezd] <path>]
[-stat [format] <path>]
[-tail [-f] <file>]
[-chmod [-R] <MODE[,MODE]... | OCTALMODE> PATH...]
[-chown [-R] [OWNER][:[GROUP]] PATH...]
[-chgrp [-R] GROUP PATH...]
[-help [cmd]]
Generic options supported are
-conf <configuration file> specify an application configuration file
-D <property=value> use value for given property
-fs <local|namenode:port> specify a namenode
-jt <local|jobtracker:port> specify a job tracker
-files <comma separated list of files> specify comma separated files to be copied to the map reduce cluster
-libjars <comma separated list of jars> specify comma separated jar files to include in the classpath.
-archives <comma separated list of 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瀏覽資訊
