| 1 | ◢ <[wiki:NTUOSS160412/Lab16 實作六]> | <[wiki:NTUOSS160412 回課程大綱]> ▲ | <[wiki:NTUOSS160412/HW1 作業]> ◣ |
| 2 | |
| 3 | = 實作七 Lab7 = |
| 4 | |
| 5 | {{{ |
| 6 | #!html |
| 7 | <p style="text-align: center;"><big style="font-weight: bold;"><big>編譯 WordCount 範例</big></big></p> |
| 8 | }}} |
| 9 | |
| 10 | [[PageOutline]] |
| 11 | |
| 12 | * 在 lab 007 與 lab008 範例中,我們可以發現 WordCount 範例程式都是以所謂的 Inner Class 語法撰寫而成,那是否可以改寫成多個 Public Class 呢?答案是可以的! |
| 13 | {{{ |
| 14 | cd ~/hadoop_labs/lab009 |
| 15 | ant |
| 16 | hadoop fs -rmr input output |
| 17 | hadoop fs -put ~/hadoop/conf input |
| 18 | hadoop jar WordCount.jar input output |
| 19 | hadoop fs -ls output |
| 20 | hadoop fs -cat output/part-r-00000 |
| 21 | }}} |
| 22 | |
| 23 | == 實作習題 == |
| 24 | |
| 25 | <問題 1> 請比較 ${HOME}/hadoop_labs/lab007/class 與 ${HOME}/hadoop_labs/lab009/class 的內容,以下哪幾個陳述是正確的?(複選) |
| 26 | <提示> |
| 27 | {{{ |
| 28 | diff ${HOME}/hadoop_labs/lab007/class ${HOME}/hadoop_labs/lab009/class |
| 29 | }}} |
| 30 | {{{ |
| 31 | #!text |
| 32 | (A) Only in ${HOME}/hadoop_labs/lab009/class/: IntSumReducer.class |
| 33 | (B) Only in ${HOME}/hadoop_labs/lab009/class/: TokenizerMapper.class |
| 34 | (C) Only in ${HOME}/hadoop_labs/lab007/class/: WordCount$IntSumReducer.class |
| 35 | (D) Only in ${HOME}/hadoop_labs/lab007/class/: WordCount$TokenizerMapper.class |
| 36 | (E) Only in ${HOME}/hadoop_labs/lab007/class/: WordCount.class |
| 37 | }}} |
| 38 | |
| 39 | <問題 2> 請問執行任務時,同時有幾個 Mapper? |
| 40 | {{{ |
| 41 | #!text |
| 42 | (A) 0 |
| 43 | (B) 同 input 目錄檔案區塊個數 |
| 44 | }}} |
| 45 | |
| 46 | <問題 3> 請問執行任務時,同時有幾個 Reducer? |
| 47 | {{{ |
| 48 | #!text |
| 49 | (A) 0 |
| 50 | (B) 1 |
| 51 | (C) 2 |
| 52 | (D) 3 |
| 53 | }}} |
| 54 | |
| 55 | <問題 4> 請問執行任務時,同一個 Map Task 會有幾個 Task Attempt? |
| 56 | {{{ |
| 57 | #!text |
| 58 | (A) 0 |
| 59 | (B) 1 個(含)以上 |
| 60 | }}} |