0

我想在 hadoop-1.0.1 上运行一个应用程序,我注意到该应用程序没有进入地图功能。在 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);

}
}

谢谢你的帮助。

4

1 回答 1

0

检查输入路径对服务器是否有效。如果那里没有数据,则不会调用映射器,因为每条记录都会调用一次。

于 2013-09-05T15:06:30.143 回答