我遇到了這些問題,同時使用Hadoop流。我在python的Hadoop流式處理問題
1)總庫包
編寫代碼根據Hadoop的流媒體文件(http://hadoop.apache.org/common/docs/r0.20.0/streaming.html#Working+with+the+Hadoop+Aggregate+Package+%28the+-reduce+aggregate+option%29),有一個內置的聚合類可以工作既作爲一個映射器和減速。
下面是一個命令:
shell> hadoop jar hadoop-streaming.jar -file mapper.py -mapper mapper.py -combiner aggregate -reducer NONE -input input_files -output output_path
執行此命令失敗,此錯誤映射器:
java.io.IOException: Cannot run program "aggregate": java.io.IOException: error=2, No such file or directory
但是,如果使用聚合作還原劑,而不是合併運行此命令,工作正常。
shell> hadoop jar hadoop-streaming.jar -file mapper.py -mapper mapper.py -reduce aggregate -reducer NONE -input input_files -output output_path
這是否意味着我不能使用聚合類作爲組合器?
2)不能使用|作爲通用選項的分隔符
這是從上面的鏈接
你不能用一個例子命令|作爲map.output.key.field.separator的參數。錯誤是
-D: command not found
11/08/03 10:48:02 ERROR streaming.StreamJob: Missing required options: input, output
(更新)您必須轉義|與此類似
-D stream.map.output.field.separator=\|
3)不能在命令末尾指定-D選項,就像在示例中一樣。該錯誤是
-D: command not found
11/08/03 10:50:23 ERROR streaming.StreamJob: Unrecognized option: -D
是文檔缺陷或我做錯了什麼?
什麼我做錯了認識任何瞭解。日Thnx
我會強烈建議拆分這分成多個問題,在這種形式是非常本地化,更適合的Hadoop用戶郵件列表 –
點指出。日Thnx –
這裏的解決方案:1) 代替組合-aggregate使用-combiner org.apache.hadoop.mapred.lib.aggregate.ValueAggregatorReducer –