| 1 | [[PageOutline]] |
| 2 | |
| 3 | ◢ <[wiki:III150110/Lab6 實作六]> | <[wiki:III150110 回課程大綱]> ▲ | <[wiki:III150110/Lab8 實作八]> ◣ |
| 4 | |
| 5 | = 實作七 Lab 7 = |
| 6 | |
| 7 | {{{ |
| 8 | #!html |
| 9 | <div style="text-align: center;"><big style="font-weight: bold;"><big>Hadoop Streaming 搭配不同程式語言練習<br/>Hadoop Streaming in different Language</big></big></div> |
| 10 | }}} |
| 11 | |
| 12 | {{{ |
| 13 | #!text |
| 14 | 以下練習,請連線至 hdp01.3du.me 操作。底下的 userXX 等於您的用戶名稱。 |
| 15 | 以下練習,請連線至 hdp02.3du.me 操作。底下的 userXX 等於您的用戶名稱。 |
| 16 | 以下練習,請連線至 hdp03.3du.me 操作。底下的 userXX 等於您的用戶名稱。 |
| 17 | 以下練習,請連線至 hdp04.3du.me 操作。底下的 userXX 等於您的用戶名稱。 |
| 18 | }}} |
| 19 | |
| 20 | == 搭配現存二進位執行檔 == |
| 21 | == Existing Binary == |
| 22 | |
| 23 | {{{ |
| 24 | ~$ hadoop fs -put /opt/hadoop/conf lab9_input |
| 25 | ~$ hadoop jar hadoop-streaming.jar -input lab9_input -output lab9_out1 -mapper /bin/cat -reducer /usr/bin/wc |
| 26 | ~$ hadoop fs -cat lab9_out1/part-00000 |
| 27 | }}} |
| 28 | |
| 29 | == 搭配 Bash Shell Script == |
| 30 | |
| 31 | {{{ |
| 32 | ~$ echo "sed -e \"s/ /\n/g\" | grep ." > streamingMapper.sh |
| 33 | ~$ echo "uniq -c | awk '{print \$2 \"\t\" \$1}'" > streamingReducer.sh |
| 34 | ~$ chmod a+x streamingMapper.sh |
| 35 | ~$ chmod a+x streamingReducer.sh |
| 36 | ~$ hadoop jar hadoop-streaming.jar -input lab9_input -output lab9_out2 -mapper streamingMapper.sh -reducer streamingReducer.sh -file streamingMapper.sh -file streamingReducer.sh |
| 37 | ~$ hadoop fs -cat lab9_out2/part-00000 |
| 38 | }}} |