<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Skynet

    ---------- ---------- 我的新 blog : liukaiyi.cublog.cn ---------- ----------

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      112 Posts :: 1 Stories :: 49 Comments :: 0 Trackbacks
    參考:
      http://hadoop.apache.org/common/docs/r0.15.2/streaming.html

    注意
      目前 streaming 對 linux pipe #也就是 cat |wc -l 這樣的管道 不支持,但不妨礙我們使用perl,python 行式命令!!
      原話是 :
      Can I use UNIX pipes? For example, will -mapper "cut -f1 | sed s/foo/bar/g" work?
        Currently this does not work and gives an "java.io.IOException: Broken pipe" error.
        This is probably a bug that needs to be investigated.
      但如果你是強烈的 linux shell pipe 發燒友 ! 參考下面
      $> perl -e 'open( my $fh, "grep -v null tt |sed -n 1,5p |");while ( <$fh> ) {print;} '
         #不過我沒測試通過 !!

    環境 :hadoop-0.18.3
    $> find . -type f -name "*streaming*.jar"
    ./contrib/streaming/hadoop-0.18.3-streaming.jar


    測試數據:
    -bash-3.00$ head tt 
    null    false    3702    208100
    6005100    false    70    13220
    6005127    false    24    4640
    6005160    false    25    4820
    6005161    false    20    3620
    6005164    false    14    1280
    6005165    false    37    7080
    6005168    false    104    20140
    6005169    false    35    6680
    6005240    false    169    32140
    ......


    運行:
    c1="  perl -ne  'if(/.*\t(.*)/){\$sum+=\$1;}END{print \"\$sum\";}'  "
    # 注意 這里 $ 要寫成 \$    " 寫成 \"
    echo $c1; # 打印輸出  perl -ne 'if(/.*"t(.*)/){$sum+=$1;}END{print $sum;}'
    hadoop jar hadoop-0.18.3-streaming.jar
      
    -input file:///data/hadoop/lky/jar/tt 
       -
    mapper   "/bin/cat" 
       -
    reducer "$c1" 
      
    -output file:///tmp/lky/streamingx8


    結果:
    cat /tmp/lky/streamingx8/*
    1166480

    本地運行輸出:
    perl -ne 'if(/.*"t(.*)/){$sum+=$1;}END{print $sum;}' < tt
    1166480

    結果正確!!!!


    命令自帶文檔:
    -bash-3.00$ hadoop jar hadoop-0.18.3-streaming.jar -info
    09/09/25 14:50:12 ERROR streaming.StreamJob: Missing required option -input
    Usage: $HADOOP_HOME
    /bin/hadoop [--config dir] jar \
              $HADOOP_HOME
    /hadoop-streaming.jar [options]
    Options:
      
    -input    <path>     DFS input file(s) for the Map step
      
    -output   <path>     DFS output directory for the Reduce step
      
    -mapper   <cmd|JavaClassName>      The streaming command to run
      
    -combiner <JavaClassName> Combiner has to be a Java class
      
    -reducer  <cmd|JavaClassName>      The streaming command to run
      
    -file     <file>     File/dir to be shipped in the Job jar file
      
    -dfs    <h:p>|local  Optional. Override DFS configuration
      
    -jt     <h:p>|local  Optional. Override JobTracker configuration
      
    -additionalconfspec specfile  Optional.
      
    -inputformat TextInputFormat(default)|SequenceFileAsTextInputFormat|JavaClassName Optional.
      
    -outputformat TextOutputFormat(default)|JavaClassName  Optional.
      
    -partitioner JavaClassName  Optional.
      
    -numReduceTasks <num>  Optional.
      
    -inputreader <spec>  Optional.
      
    -jobconf  <n>=<v>    Optional. Add or override a JobConf property
      
    -cmdenv   <n>=<v>    Optional. Pass env.var to streaming commands
      
    -mapdebug <path>  Optional. To run this script when a map task fails 
      
    -reducedebug <path>  Optional. To run this script when a reduce task fails 
      
    -cacheFile fileNameURI
      
    -cacheArchive fileNameURI
      
    -verbose




    整理 m.tkk7.com/Good-Game
    posted on 2009-09-25 14:33 劉凱毅 閱讀(3377) 評論(0)  編輯  收藏 所屬分類: perl集群開發數據挖掘
    主站蜘蛛池模板: 182tv免费视视频线路一二三| 国产精品免费久久久久影院| 亚洲国产成人精品91久久久| 亚洲国产激情在线一区| 最新亚洲人成无码网www电影| 女人张开腿给人桶免费视频| 在线aⅴ亚洲中文字幕| www.999精品视频观看免费| 国产色在线|亚洲| 日韩黄色免费观看| 少妇中文字幕乱码亚洲影视| 污视频在线观看免费| 久久精品国产亚洲av水果派 | 亚洲线精品一区二区三区| 亚洲视频一区在线| 一个人看的www在线免费视频 | 成人无码区免费A片视频WWW| 亚洲av无码片区一区二区三区| 免费黄色福利视频| 亚洲av永久无码精品网址| 7x7x7x免费在线观看| 亚洲精品美女久久久久99| 91久久青青草原线免费| 亚洲人成综合网站7777香蕉 | 国产精品亚洲产品一区二区三区 | 亚洲日韩精品一区二区三区无码| 免费成人高清在线视频| 91亚洲精品麻豆| 成人永久免费高清| 人妻免费一区二区三区最新| 亚洲精品乱码久久久久久下载| 成人免费一区二区无码视频| 亚洲福利一区二区| 国产精品高清全国免费观看| 久久久WWW免费人成精品| 五月婷婷亚洲综合| 白白色免费在线视频| 亚洲αv在线精品糸列| 久久精品a一国产成人免费网站 | 亚洲国产午夜福利在线播放| 99re6在线精品视频免费播放|