是否有针对hadoop流的组合输入格式?

时间:2013-10-21 02:52:38

标签: hadoop mapreduce streaming

我有许多小输入文件,我想使用像CombineFileInputFormat这样的输入格式组合它们来启动更少的映射器任务。我知道我可以使用Java API来实现这一点,但我不知道在使用Hadoop流时是否有支持此功能的流式jar库。

1 个答案:

答案 0 :(得分:2)

Hadoop流媒体默认使用TextInputFormat,但可以使用任何其他输入格式,包括CombineFileInputFormat。您可以使用选项-inputformat从命令行更改输入格式。请务必使用旧API并实施org.apache.hadoop.mapred.lib.CombineFileInputFormat。目前还不支持新的API。

$HADOOP_HOME/bin/hadoop jar \
      $HADOOP_HOME/hadoop-streaming.jar \
      -inputformat foo.bar.MyCombineFileInputFormat \
      -Dmapred.max.split.size=524288000 \
      -Dstream.map.input.ignoreKey=true \
      ...

Example of CombineFileInputFormat