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