我正在尝试实现一个 MapReduce 作业,其中每个映射器将占用文本文件的 150 行,并且所有映射器将同时运行;此外,无论有多少映射任务失败,它都不应失败。
这是配置部分:
JobConf conf = new JobConf(Main.class);
conf.setJobName("My mapreduce");
conf.set("mapreduce.input.lineinputformat.linespermap", "150");
conf.set("mapred.max.map.failures.percent","100");
conf.setInputFormat(NLineInputFormat.class);
FileInputFormat.addInputPath(conf, new Path(args[0]));
FileOutputFormat.setOutputPath(conf, new Path(args[1]));
问题在于,hadoop 为每一行文本创建一个映射器,它们似乎按顺序运行,如果单个映射器失败,作业就会失败。
由此我推断,我应用的设置没有任何效果。
我做错了什么?
我假设您使用的是 Hadoop 0.20。在 0.20 中,配置参数是“mapred.line.input.format.linespermap”,并且您正在使用“mapreduce.input.lineinputformat.linespermap”。如果未设置配置参数,则默认为 1,因此您将看到查询中提到的行为。
这是 0.20 NLineInputFormat 中的代码片段。
公共无效配置(JobConf conf){ N = conf.getInt(“mapred.line.input.format.linespermap”,1); }
Hadoop 配置有时确实很痛苦,没有正确记录,而且我观察到配置参数有时在版本之间也会不断变化。最好的办法是在不确定某些配置参数时查看代码。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)