问题描述
我是用新的Hadoop 1.0.4的API(类包org.apache.hadoop.ma preduce)。当我想链映射/减速,我发现ChainMapper,ChainReducer是为老API(封装org.apache.hadoop.ma preD类)编写的。我应该怎么办?
I was using "new" API of Hadoop 1.0.4 (classes in package org.apache.hadoop.mapreduce). When I wanted to chain mapper/reducer, I found out that ChainMapper, ChainReducer are written for the "old" API (classes in package org.apache.hadoop.mapred). What should I do?
推荐答案
我也搜索相同。我没有得到答案,即使较晚我想分享这可以帮助别人。
I was also searching for the same. I did get the answer and even though its late I thought sharing this may help someone.
从Hadoop的2.0起,你可以找到ChainMapper和ChainReducer在包中的 org.apache.hadoop.ma preduce.lib.chain
From Hadoop 2.0 onwards you can find ChainMapper and ChainReducer in the package org.apache.hadoop.mapreduce.lib.chain
...
Job job = new Job(conf, "MyJob");
Configuration map1Conf = new Configuration(false);
... ChainMapper.addMapper(job, AMap.class, LongWritable.class, Text.class, Text.class, Text.class, true, map1Conf);
Configuration map2Conf = new Configuration(false);
... ChainMapper.addMapper(job, BMap.class, Text.class, Text.class, LongWritable.class, Text.class, false, map2Conf);
Configuration map3Conf = new Configuration(false);
... ChainReducer.setReducer(job, CReducer.class, Text.class, Text.class, LongWritable.class, Text.class, false, map3Conf);
...
job.waitForComplettion(true);
...
这篇关于如何在Hadoop的1.0.4链映射/减速?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!