| | 19 | |
| | 20 | * 放資料上hdfs |
| | 21 | |
| | 22 | {{{ |
| | 23 | $ mkdir input |
| | 24 | $ cp /tmp/bio.txt input |
| | 25 | $ hadoop fs -put input input |
| | 26 | |
| | 27 | 在作一次試試看 |
| | 28 | $ mkdir hello |
| | 29 | $ cp /tmp/hello.txt hello/ |
| | 30 | $ hadoop fs -put hello hello1 |
| | 31 | $ hadoop fs -put hello hello2 |
| | 32 | }}} |
| | 33 | |
| | 34 | * 再次查看是否成功放入資料 |
| | 35 | |
| | 36 | {{{ |
| | 37 | $ hadoop fs -ls |
| | 38 | }}} |
| | 39 | |
| | 40 | * 刪除資料 |
| | 41 | |
| | 42 | {{{ |
| | 43 | $ hadoop fs -rmr hello2 |
| | 44 | }}} |
| | 45 | |
| | 46 | * 下載資料 |
| | 47 | |
| | 48 | {{{ |
| | 49 | $ hadoop fs -get hello1 whatisthat |
| | 50 | $ ls |
| | 51 | }}} |
| | 52 | |
| | 53 | * 印出hdfs上的資料內容 |
| | 54 | |
| | 55 | {{{ |
| | 56 | $ hadoop fs -cat hello1/hello.txt |
| | 57 | }}} |
| | 58 | |
| | 59 | * [http://trac.nchc.org.tw/cloud/wiki/0428Hadoop_Lab2 更多練習] |