减速器没有在hadoop中执行

时间:2013-08-17 14:42:33

标签: hadoop mapreduce reduce

我非常喜欢这个hadoop,我试图执行一个简单的mapreduce作业链,但在我的代码中,reducer没有被执行。这里有简单的代码我写的

这是我的映射器代码

@Override
    public void map(LongWritable arg0, Text arg1,
            OutputCollector<Text, IntWritable> arg2, Reporter arg3)
            throws IOException {
        // TODO Auto-generated method stub
        System.out.println("in first mapper");

    }

@Override public void map(LongWritable arg0, Text arg1, OutputCollector<Text, IntWritable> arg2, Reporter arg3) throws IOException { // TODO Auto-generated method stub System.out.println("in first mapper"); }

这是我的简单缩减代码

@Override
public void reduce(Text arg0, Iterator<IntWritable> arg1,
        OutputCollector<Text, IntWritable> arg2, Reporter arg3)
        throws IOException {
    // TODO Auto-generated method stub
    System.out.println("in reducer");

}

这是运行作业的主要类

@Override public void reduce(Text arg0, Iterator<IntWritable> arg1, OutputCollector<Text, IntWritable> arg2, Reporter arg3) throws IOException { // TODO Auto-generated method stub System.out.println("in reducer"); }

不知道我哪里出错了。减速机中的sysout没有打印出来。对此有何帮助?

1 个答案:

答案 0 :(得分:0)

可能的原因:您没有从映射器中输出任何内容,以便减速器首先运行。尝试使用映射器中的outputCollector.collect(key, value);为reducers实际运行写一些内容。

相关问题