Changes between Version 1 and Version 2 of NCHCCloudCourse100928/Lab1_1


Ignore:
Timestamp:
Jul 20, 2011, 11:05:20 PM (13 years ago)
Author:
waue
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NCHCCloudCourse100928/Lab1_1

    v1 v2  
    22#!html
    33<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>
    55}}}
    66[[PageOutline]]
     
    3232{{{
    3333
    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/wc
    35 hadoop@lucid:/opt/hadoop$ cat output/part-00000
     34hadoop@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
     35hadoop@lucid:/opt/hadoop$ cat output-1/part-00000
    3636}}}
    3737 * 範例二:使用 Bash Shell Script 當 Mapper 與 Reducer
     
    3939hadoop@lucid:/opt/hadoop$ echo "sed -e \"s/ /\n/g\" | grep ." > streamingMapper.sh
    4040hadoop@lucid:/opt/hadoop$ echo "uniq -c | awk '{print \$2 \"\t\" \$1}'" > streamingReducer.sh
    41 hadoop@lucid:/opt/hadoop$ chmod a+x streamingMapper.sh
    42 hadoop@lucid:/opt/hadoop$ chmod a+x streamingReducer.sh
    43 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
     41hadoop@lucid:/opt/hadoop$ chmod a+x *.sh
     42hadoop@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
     43hadoop@lucid:/opt/hadoop$ cat output-2/part-00000
    4444}}}
    45  * 觀看執行結果
    46 {{{
    47 hadoop@lucid:/opt/hadoop$ bin/hadoop fs -cat output/part-00000
    48 }}}
     45