| 1 | [[PageOutline]] |
| 2 | |
| 3 | ◢ <[wiki:Hinet130923/Lab3 實作三]> | <[wiki:Hinet130923 回課程大綱]> ▲ | <[wiki:Hinet130923/Lab5 實作五]> ◣ |
| 4 | |
| 5 | = 實作四 Lab 4 = |
| 6 | |
| 7 | {{{ |
| 8 | #!html |
| 9 | <div style="text-align: center;"><big style="font-weight: bold;"><big>HDFS 基本指令操作練習<br/>HDFS in practice (full distributed mode)</big></big></div> |
| 10 | }}} |
| 11 | |
| 12 | == Content 1: HDFS Shell 基本操作 == |
| 13 | == Content 1: Basic HDFS Shell Commands == |
| 14 | |
| 15 | === 1.1 瀏覽你HDFS目錄 === |
| 16 | === 1.1 Browsing Your HDFS Folder === |
| 17 | |
| 18 | {{{ |
| 19 | ~$ hadoop fs -ls |
| 20 | }}} |
| 21 | |
| 22 | === 1.2 上傳資料到 HDFS 目錄 === |
| 23 | === 1.2 Upload Files or Folder to HDFS === |
| 24 | |
| 25 | * 上傳 Upload |
| 26 | |
| 27 | {{{ |
| 28 | ~$ hadoop fs -put /opt/hadoop/conf input |
| 29 | }}} |
| 30 | |
| 31 | * 檢查 Check |
| 32 | |
| 33 | {{{ |
| 34 | ~$ hadoop fs -ls |
| 35 | }}} |
| 36 | |
| 37 | === 1.3 下載 HDFS 的資料到本地目錄 === |
| 38 | === 1.3 Download HDFS Files or Folder to Local === |
| 39 | |
| 40 | * 下載 Download |
| 41 | |
| 42 | {{{ |
| 43 | ~$ hadoop fs -get input fromHDFS |
| 44 | }}} |
| 45 | |
| 46 | * 檢查 Check |
| 47 | {{{ |
| 48 | ~$ ls -al | grep fromHDFS |
| 49 | ~$ diff /opt/hadoop/conf fromHDFS/ |
| 50 | }}} |
| 51 | |
| 52 | === 1.4 刪除檔案 === |
| 53 | === 1.4 Remove Files or Folder === |
| 54 | |
| 55 | {{{ |
| 56 | ~$ hadoop fs -ls input/masters |
| 57 | ~$ hadoop fs -rm input/masters |
| 58 | }}} |
| 59 | |
| 60 | === 1.5 直接看檔案 === |
| 61 | === 1.5 Browse Files Directly === |
| 62 | |
| 63 | {{{ |
| 64 | ~$ hadoop fs -ls input/slaves |
| 65 | ~$ hadoop fs -cat input/slaves |
| 66 | }}} |
| 67 | |
| 68 | === 1.6 更多指令操作 === |
| 69 | === 1.6 More Commands -- Help message === |
| 70 | |
| 71 | {{{ |
| 72 | ~$ hadoop fs |
| 73 | |
| 74 | Usage: java FsShell |
| 75 | [-ls <path>] |
| 76 | [-lsr <path>] |
| 77 | [-du <path>] |
| 78 | [-dus <path>] |
| 79 | [-count[-q] <path>] |
| 80 | [-mv <src> <dst>] |
| 81 | [-cp <src> <dst>] |
| 82 | [-rm <path>] |
| 83 | [-rmr <path>] |
| 84 | [-expunge] |
| 85 | [-put <localsrc> ... <dst>] |
| 86 | [-copyFromLocal <localsrc> ... <dst>] |
| 87 | [-moveFromLocal <localsrc> ... <dst>] |
| 88 | [-get [-ignoreCrc] [-crc] <src> <localdst>] |
| 89 | [-getmerge <src> <localdst> [addnl]] |
| 90 | [-cat <src>] |
| 91 | [-text <src>] |
| 92 | [-copyToLocal [-ignoreCrc] [-crc] <src> <localdst>] |
| 93 | [-moveToLocal [-crc] <src> <localdst>] |
| 94 | [-mkdir <path>] |
| 95 | [-setrep [-R] [-w] <rep> <path/file>] |
| 96 | [-touchz <path>] |
| 97 | [-test -[ezd] <path>] |
| 98 | [-stat [format] <path>] |
| 99 | [-tail [-f] <file>] |
| 100 | [-chmod [-R] <MODE[,MODE]... | OCTALMODE> PATH...] |
| 101 | [-chown [-R] [OWNER][:[GROUP]] PATH...] |
| 102 | [-chgrp [-R] GROUP PATH...] |
| 103 | [-help [cmd]] |
| 104 | |
| 105 | Generic options supported are |
| 106 | -conf <configuration file> specify an application configuration file |
| 107 | -D <property=value> use value for given property |
| 108 | -fs <local|namenode:port> specify a namenode |
| 109 | -jt <local|jobtracker:port> specify a job tracker |
| 110 | -files <comma separated list of files> specify comma separated files to be copied to the map reduce cluster |
| 111 | -libjars <comma separated list of jars> specify comma separated jar files to include in the classpath. |
| 112 | -archives <comma separated list of archives> specify comma separated archives to be unarchived on the compute machines. |
| 113 | The general command line syntax is |
| 114 | hadoop command [genericOptions] [commandOptions] |
| 115 | }}} |
| 116 | |
| 117 | == Content 2: 使用網頁 GUI 瀏覽資訊 == |
| 118 | == Content 2: User Web GUI to browse HDFS == |
| 119 | |
| 120 | * 連上 http://nodeN.3du.me:50070 的 NameNode Web Interface ,請將 N 取代為您的報名序號 |