add*_*015 26
您问题的直接答案是=> COMBINER
细节:可以在地图阶段将组合器视为迷你减速器.它们在进一步分发之前对映射器结果执行local-reduce.一旦执行了Combiner功能,它就会被传递给Reducer以进行进一步的工作.
在哪里
当我们在减速机上工作时,分区器就会出现在图片中.因此,分区程序决定哪个reducer负责特定键.它们基本上采用Mapper结果(如果使用Combiner然后使用Combiner Result)并根据键将其发送到负责的Reducer.
为了更好地理解,您可以参考下面的图片,这是我从Hadoop上的Yahoo Developer Tutorial中获取的.

这是教程.
小智 5
分区排在第一位.
根据"Hadoop,权威指南",Mapper的输出首先写入内存缓冲区,然后当缓冲区即将溢出时溢出到本地目录.根据分区程序将溢出数据分开,并且在每个分区中,如果给出Combiner,则对结果进行排序和组合.
您只需修改wordcount MR程序即可对其进行验证.我的结果是:("快速的棕色狐狸跳过一只懒狗")
单词,步骤,时间
福克斯,Mapper,**********754
狐狸,分区,**********754
fox,Combiner,**********850
狐狸,减速器,**********904
显然,Combiner在Partitioner之后运行.
小智 5
Partitioner之前运行Combiner:MapReduce 综合图。
您可以拥有自定义分区逻辑,在对映射器结果进行分区后,对分区进行排序并将其Combiner应用于排序后的分区。
Combiner我通过运行带有自定义和时间戳记录的字数统计程序来检查它Partitioner:
Apr 23, 2018 2:41:22 PM mapreduce.WordCountPartitioner getPartition
INFO: Partitioner: 1524483682580 : hello : 1
Apr 23, 2018 2:41:22 PM mapreduce.WordCountPartitioner getPartition
INFO: Partitioner: 1524483682582 : hello : 1
Apr 23, 2018 2:41:22 PM mapreduce.WordCountPartitioner getPartition
INFO: Partitioner: 1524483682583 : hello : 1
Apr 23, 2018 2:41:22 PM mapreduce.WordCountPartitioner getPartition
INFO: Partitioner: 1524483682583 : world : 1
Apr 23, 2018 2:41:22 PM mapreduce.WordCountPartitioner getPartition
INFO: Partitioner: 1524483682584 : world : 1
Apr 23, 2018 2:41:22 PM mapreduce.WordCountPartitioner getPartition
INFO: Partitioner: 1524483682585 : hello : 1
Apr 23, 2018 2:41:22 PM mapreduce.WordCountPartitioner getPartition
INFO: Partitioner: 1524483682585 : world : 1
18/04/23 14:41:22 INFO mapred.LocalJobRunner:
18/04/23 14:41:22 INFO mapred.MapTask: Starting flush of map output
18/04/23 14:41:22 INFO mapred.MapTask: Spilling map output
18/04/23 14:41:22 INFO mapred.MapTask: bufstart = 0; bufend = 107; bufvoid = 104857600
18/04/23 14:41:22 INFO mapred.MapTask: kvstart = 26214396(104857584); kvend = 26214368(104857472); length = 29/6553600
Apr 23, 2018 2:41:22 PM mapreduce.WordCountCombiner reduce
INFO: Combiner: 1524483682614 : hello
Apr 23, 2018 2:41:22 PM mapreduce.WordCountCombiner reduce
INFO: Combiner: 1524483682615 : world
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7650 次 |
| 最近记录: |