我想在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);
}
}
谢谢你的帮助。
1条答案
按热度按时间yacmzcpb1#
检查输入路径是否对服务器有效。如果那里没有数据,那么Map器就不会被调用,因为它每个记录被调用一次。