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