简体   繁体   English

如何在 MapReduce 中将信息从一个减速器传递到另一个减速器

[英]How to pass information from one reducer to another in MapReduce

I have two mappers and two reducers (1 and 2).我有两个映射器和两个减速器(1 和 2)。 My driver class runs two jobs that take in two different input files and output two different output files (again, 1 and 2).我的驱动程序类运行两个作业,它们接收两个不同的输入文件并输出两个不同的输出文件(同样是 1 和 2)。 So job1 is associated with inputfile1, outputfile1, map1 and reduce1;所以job1与inputfile1、outputfile1、map1和reduce1相关联; similarly for job2. job2 类似。

Reduce1 outputs data of the form (id, number) using context.write. Reduce1 使用 context.write 输出形式为 (id, number) 的数据。 My goal is to access these key value pairs in Reduce2, but I cannot figure out how.我的目标是在 Reduce2 中访问这些键值对,但我不知道如何访问。 I have tried doing a conf.setInt in reduce1, but the values are not being passed into reduce2, because I don't get them when I do a conf.getInt.我试过在reduce1 中做一个conf.setInt,但是这些值没有被传递到reduce2,因为当我做一个conf.getInt 时我没有得到它们。

Coming back to this, in my experience, you write output to one path, then run another job with that path as input...回到这一点,根据我的经验,您将输出写入一个路径,然后使用该路径作为输入运行另一个作业......

In theory, you can create two Jobs in one program if you add more code after the waitForCompletion method on the first Job理论上,如果在第一个 Job 的waitForCompletion方法之后添加更多代码,则可以在一个程序中创建两个 Job

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM