Changes between Version 1 and Version 2 of NCHCCloudCourse100928/Lab1_1
- Timestamp:
- Jul 20, 2011, 11:05:20 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TabularUnified NCHCCloudCourse100928/Lab1_1
v1 v2 2 2 #!html 3 3 <div style="text-align: center;"><big 4 style="font-weight: bold;"><big><big>實作一: Hadoop Streaming 操作練習</big></big></big></div>4 style="font-weight: bold;"><big><big>實作一: Streaming 操作練習 on Standard Mode </big></big></big></div> 5 5 }}} 6 6 [[PageOutline]] … … 32 32 {{{ 33 33 34 hadoop@lucid:/opt/hadoop$ bin/hadoop jar ./contrib/streaming/hadoop-0.20.2-streaming.jar -input input -output output -mapper /bin/cat -reducer /usr/bin/wc35 hadoop@lucid:/opt/hadoop$ cat output /part-0000034 hadoop@lucid:/opt/hadoop$ bin/hadoop jar ./contrib/streaming/hadoop-0.20.2-streaming.jar -input input -output output-1 -mapper /bin/cat -reducer /usr/bin/wc 35 hadoop@lucid:/opt/hadoop$ cat output-1/part-00000 36 36 }}} 37 37 * 範例二:使用 Bash Shell Script 當 Mapper 與 Reducer … … 39 39 hadoop@lucid:/opt/hadoop$ echo "sed -e \"s/ /\n/g\" | grep ." > streamingMapper.sh 40 40 hadoop@lucid:/opt/hadoop$ echo "uniq -c | awk '{print \$2 \"\t\" \$1}'" > streamingReducer.sh 41 hadoop@lucid:/opt/hadoop$ chmod a+x streamingMapper.sh42 hadoop@lucid:/opt/hadoop$ chmod a+xstreamingReducer.sh43 hadoop@lucid:/opt/hadoop$ bin/hadoop jar ./contrib/streaming/hadoop-0.20.2-streaming.jar -input input -output output -mapper streamingMapper.sh -reducer streamingReducer.sh -file streamingMapper.sh -file streamingReducer.sh41 hadoop@lucid:/opt/hadoop$ chmod a+x *.sh 42 hadoop@lucid:/opt/hadoop$ bin/hadoop jar ./contrib/streaming/hadoop-0.20.2-streaming.jar -input input -output output-2 -mapper streamingMapper.sh -reducer streamingReducer.sh -file streamingMapper.sh -file streamingReducer.sh 43 hadoop@lucid:/opt/hadoop$ cat output-2/part-00000 44 44 }}} 45 * 觀看執行結果 46 {{{ 47 hadoop@lucid:/opt/hadoop$ bin/hadoop fs -cat output/part-00000 48 }}} 45