嗨,我对这个 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 reduce(Text arg0, Iterator<IntWritable> arg1,
OutputCollector<Text, IntWritable> arg2, Reporter arg3)
throws IOException {
// TODO Auto-generated method stub
System.out.println("in reducer");
}
这是运行工作的主类
JobConf jobConf = new JobConf(jobrunner.class);
jobConf.setJobName("Chaining");
FileInputFormat.setInputPaths(jobConf, new Path("hdfs://localhost:9000/employee_data.txt"));
FileOutputFormat.setOutputPath(jobConf,new Path("hdfs://localhost:9000/chain3.txt"));
JobConf conf1 = new JobConf(false);
ChainMapper.addMapper(jobConf,chainmap.class,LongWritable.class,Text.class,Text.class,IntWritable.class,true,conf1);
JobConf conf2 = new JobConf(false);
ChainReducer.setReducer(jobConf, chainreduce.class,Text.class,IntWritable.class,Text.class,IntWritable.class,true,conf2);
JobClient.runJob(jobConf);
不知道我哪里出错了。reducer 中的 sysout 没有被打印出来。对此有什么帮助吗?