【问题标题】:hadoop mapreduce only one mapper is executedhadoop mapreduce 只执行一个映射器
【发布时间】:2015-10-14 19:52:05
【问题描述】:

我正在运行 map reduce 作业。无论文件大小(70 MB、200 MB、2.5 GB),只运行一个映射器。块大小为 128MB。

谁能帮忙看看是什么原因?

注意

  1. 数据文件不是 zip/gzip 文件,它是 *.dat
  2. 这不是生产环境。用户是否有可能是低优先级用户?编号#11 https://cloudcelebrity.wordpress.com/2013/08/14/12-key-steps-to-keep-your-hadoop-cluster-running-strong-and-performing-optimum/

。

我提交作业的代码如下:

    String configPath = arg[0];
    String feedString = FileUtils.readFileToString(new File(configPath), StandardCharsets.UTF_8.name());
    getConf().set(Constants.FEED_CONFIG_STRING, feedString);
    getConf().set("mapred.reduce.tasks.speculative.execution", "false");

    Job job = new Job(conf);
    Feed feed = XMLFeedConfig.getFeed(feedString);
    job.setJarByClass(DataValidationJob.class);
    job.setJobName("Job " + feed.getName());

    ValidatorInputFormat.setInputPaths(job, new Path(feed.getSrc_location()));
    FileOutputFormat.setOutputPath(job, new Path(feed.getDest_location()));

    job.setMapOutputKeyClass(Text.class);
    job.setMapOutputValueClass(Text.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(Text.class);

    job.setMapperClass(ValidatorMapper.class);
    job.setReducerClass(ValidatorReducer.class);
    LazyOutputFormat.setOutputFormatClass(job, TextOutputFormat.class);
    job.setNumReduceTasks(1);

    job.setInputFormatClass(ValidatorInputFormat.class);
    // job.setOutputFormatClass(TextOutputFormat.class);

    return job.waitForCompletion(true) ? 0 : 1;

【问题讨论】:

  • 你能发布你得到的日志吗
  • 什么是ValidatorInputFormat?
  • ValidatorInputFormat 是一个简单的 RecordReader 实现

标签: hadoop mapreduce hdfs mapper


【解决方案1】:

我的问题已经解决。基本上我们已经实现了 FileInputFormat ,其中我们重写了 isSplittable 方法并使输入不可拆分,如下所示:

@Override
protected boolean isSplitable(JobContext context, Path filename) {
    return false;
}

默认实现isSplittable方法返回true;

【讨论】:

  • 很高兴了解它
猜你喜欢
  • 2016-01-21
  • 1970-01-01
  • 2016-05-03
  • 2019-09-23
  • 1970-01-01
  • 1970-01-01
  • 2011-08-28
  • 2013-07-18
  • 1970-01-01
相关资源
最近更新 更多