Changes between Version 3 and Version 4 of NCHCCloudCourse100928/Lab1
- Timestamp:
- Sep 28, 2010, 9:21:13 AM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TabularUnified NCHCCloudCourse100928/Lab1
v3 v4 31 31 == Hadoop Streaming with commands == 32 32 33 * 範例一:使用 cat 當 mapper,使用 wc 當 reducer 33 34 {{{ 34 35 hadoop@lucid:~$ cd /opt/hadoop 35 hadoop@lucid:/opt/hadoop$ hadoop fs -rmr input output36 hadoop@lucid:/opt/hadoop$ hadoop fs -put /etc/hadoop/conf input37 hadoop@lucid:/opt/hadoop$ hadoop jar hadoop-streaming.jar -input input -output output -mapper /bin/cat -reducer /usr/bin/wc36 hadoop@lucid:/opt/hadoop$ bin/start-all.sh 37 hadoop@lucid:/opt/hadoop$ bin/hadoop fs -put conf input 38 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/wc 38 39 }}} 39 40 * 範例二:使用 Bash Shell Script 當 Mapper 與 Reducer 40 41 {{{ 41 42 hadoop@lucid:/opt/hadoop$ echo "sed -e \"s/ /\n/g\" | grep ." > streamingMapper.sh … … 43 44 hadoop@lucid:/opt/hadoop$ chmod a+x streamingMapper.sh 44 45 hadoop@lucid:/opt/hadoop$ chmod a+x streamingReducer.sh 45 hadoop@lucid:/opt/hadoop$ hadoop fs -rmr input output46 hadoop@lucid:/opt/hadoop$ hadoop fs -put /etc/hadoop/conf input47 hadoop@lucid:/opt/hadoop$ hadoop jar hadoop-streaming.jar -input input -output output -mapper streamingMapper.sh -reducer streamingReducer.sh -file streamingMapper.sh -file streamingReducer.sh46 hadoop@lucid:/opt/hadoop$ bin/hadoop fs -rmr input output 47 hadoop@lucid:/opt/hadoop$ bin/hadoop fs -put conf input 48 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.sh 48 49 }}}