我想在hadoop-1.0.1上运行一个应用程序,我注意到应用程序没有进入map函数。在hadoop local上,应用程序正常运行,但在分布式hadoop上,不会调用map函数。
我有这个结构
Class Embed {
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, LongWritable> {
public void map(LongWritable key, Text value, OutputCollector<Text, LongWritable> output, Reporter reporter) throws IOException {
........
}
}
public static class Reduce extends MapReduceBase implements Reducer<Text, LongWritable, Text, LongWritable> {
public void reduce(Text key, Iterator<LongWritable> values, OutputCollector<Text, LongWritable> output, Reporter reporter) throws IOException {
..........
}
public static void main(String[] args) throws Exception {
readArguments(args);
JobConf conf = new JobConf(Embed.class);
conf.setJobName("embed");
conf.setOutputKeyClass(Text.class);
conf.setOutputValueClass(LongWritable.class);
conf.setMapperClass(Map.class);
//conf.setCombinerClass(Reduce.class);
conf.setReducerClass(Reduce.class);
conf.setInputFormat(TextInputFormat.class);
conf.setOutputFormat(TextOutputFormat.class);
FileInputFormat.setInputPaths(conf, new Path(input));
FileOutputFormat.setOutputPath(conf, new Path(output));
JobClient.runJob(conf);
}
}
感谢您的帮助。
答案 0 :(得分:0)
检查输入路径是否对服务器有效。如果那里没有数据,则不会调用映射器,因为每个记录调用一次。