2
由於Map/Reduce應用程序的本質,可能會多次調用reduce
函數,因此輸入/輸出鍵值必須與MongoDB的Map/Reduce實現相同。我不知道爲什麼在Hadoop實現它是不同的(我還是說,這是允許不同)爲什麼減速機有不同的輸入/輸出鍵,hadoop map/reduce中的值?
org.apache.hadoop.mapreduce.Reducer<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
第二個問題:Hadoop的知道如何減少函數的輸出應返回到明年再減少運行或寫入HDFS? 例如:
public class MyReducer extends Reducer<Text, IntWritable, Text, IntWritable>
public void reduce(Text key, Iterable<IntWritable> values, Context context) {
context.write(key, value) /* this key/value will be returned to reduce in next run or will be written to HDFS? */
}
}
如果通過reduce的'iterable'太大而不適合ram會怎麼樣? –
這就是爲什麼它是迭代器而不是集合的原因 - 所以Hadoop可以從磁盤提供數據。 –
這個餵食與減少工作的運行平行嗎?因爲地圖輸出保存在具有大小限制的本地磁盤(不是hdfs)上。 –