Changes between Initial Version and Version 1 of waue/2011/0426_1


Ignore:
Timestamp:
Apr 25, 2011, 3:08:48 PM (14 years ago)
Author:
waue
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • waue/2011/0426_1

    v1 v1  
     1
     2{{{
     3#!html
     4<div style="text-align: center; color:#151B8D"><big style="font-weight: bold;"><big><big>
     5ITRI HBase 進階課程
     6</big></big></big></div> <div style="text-align: center; color:#7E2217"><big style="font-weight: bold;"><big>
     71. Streaming
     8</big></big></div>
     9}}}
     10
     11[wiki:waue/2011/0426 回課程大綱 << ] Stream 範例
     12
     13
     14== Hadoop Streaming with commands ==
     15
     16 * 範例一:使用 cat 當 mapper,使用 wc 當 reducer
     17{{{
     18hadoop@lucid:~$ cd /opt/hadoop
     19hadoop@lucid:/opt/hadoop$ bin/start-all.sh
     20hadoop@lucid:/opt/hadoop$ bin/hadoop fs -put conf input
     21hadoop@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
     22}}}
     23 * 範例二:使用 Bash Shell Script 當 Mapper 與 Reducer
     24{{{
     25hadoop@lucid:/opt/hadoop$ echo "sed -e \"s/ /\n/g\" | grep ." > streamingMapper.sh
     26hadoop@lucid:/opt/hadoop$ echo "uniq -c | awk '{print \$2 \"\t\" \$1}'" > streamingReducer.sh
     27hadoop@lucid:/opt/hadoop$ chmod a+x streamingMapper.sh
     28hadoop@lucid:/opt/hadoop$ chmod a+x streamingReducer.sh
     29hadoop@lucid:/opt/hadoop$ bin/hadoop fs -rmr input output
     30hadoop@lucid:/opt/hadoop$ bin/hadoop fs -put conf input
     31hadoop@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
     32}}}