Number of reducers in hadoop

后端 未结 4 1285
没有蜡笔的小新
没有蜡笔的小新 2021-02-20 10:35

I was learning hadoop, I found number of reducers very confusing :

1) Number of reducers is same as number of partitions.

2) Number of reducers is 0.95 or 1.75 m

4条回答
  •  难免孤独
    2021-02-20 11:03

    Partitioner makes sure that same keys from multiple mappers goes to the same reducer. This doesn't mean that number of partitions is equal to number of reducers. However, you can specify number of reduce tasks in the driver program using job instance like job.setNumReduceTasks(2). If you don't specify the number of reduce tasks in the driver program then it picks from the mapred.reduce.tasks which has the default value of 1 (https://hadoop.apache.org/docs/r1.0.4/mapred-default.html) i.e. all mappers output will go to the same reducer.

    Also, note that programmer will not have control over number of mappers as it depends on the input split where as programmer can control the number of reducers for any job.

提交回复
热议问题