/ /パイプコマンドラインhadoopストリーミングジョブ - python、pipe、stdout、hadoop-streaming

パイプコマンドラインhadoopストリーミングジョブ - python、pipe、stdout、hadoop-streaming

私はハープ・ストリーミング・ジョブをパイプしたい。 たとえば、私はコマンドを実行していた hadoop jar hadoop-streaming.jar -mapper map1.py -reducer reducer.py 入力xx -output / output1

しかし、私はステップ1からの出力をhdfsに格納せずにmapreduceジョブの私のステップ2の入力は、おそらく標準出力として出力されます。 Linuxのパイプのようなものがありますか? といった hadoop jar hadoop-streaming.jar -mapper map1.py -reducer reducer.py -input xx | hadoop jar hadoop-streaming.jar -mapper map2.py リデュースリデューサー2.py 出力/出力

回答:

回答№1は0

私も同じ問題があり、bash / shellスクリプトを使用してhadoopストリーミングコマンドを実行しました。 hadoop.shという名前のファイルを作成しました。

rm -r output | bin/hadoop jar share/hadoop/tools/lib/hadoop-streaming-2.7.3.jar -files /hadoop-2.7.3/script/mapper.php -input /data/* -output output -mapper "php mapper.php" -jobconf mapred.reduce.tasks=1
#add a beginning/ending php to the file
ex -sc "1i|<?php" -c "$a|?>" -cx output/part-00000
#move the file from /output to /script
mv /hadoop-2.7.3/output/part-00000 /hadoop-2.7.3/script/part-00000.php

part-00000ファイルは、次のhadoopコマンドのpart0000.phpファイルになります。