2013-10-21 70 views
1

我有很多小的輸入文件,我想用CombineFileInputFormat之類的輸入格式來合併它們來啓動更少的映射器任務。我知道我可以使用Java API來執行此操作,但我不知道在使用Hadoop流時,是否有流式jar庫支持此功能。是否有混合輸入格式的hadoop流?

回答

2

Hadoop streaming默認使用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