【发布时间】:2015-10-09 09:35:09
【问题描述】:
我正在运行一个 map reduce 作业,其中 reducer 的数量设置为默认值(一个 reducer)。理论上,每个reducer的输出必须是一个文件,但是当我运行我的工作时,我有两个文件
part-r-00000
和
part-r-00001
为什么会这样?
我的集群中只有一个节点。
我的驱动类:
公共类 DriverDate 扩展配置实现工具 { @覆盖 public int run(String[] args) 抛出异常 { if (args.length != 2) { System.out.printf("用法:AvgWordLength inputDir outputDir\n"); System.exit(-1); } 工作工作=新工作(getConf()); job.setJobName("工作转换日期"); job.setJarByClass(DriverDate.class); job.setMapperClass(MapDate.class); job.setReducerClass(ReduceDate.class); job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(NullWritable.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(NullWritable.class); FileInputFormat.setInputPaths(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); 作业.waitForCompletion(true); 返回0; } 公共静态 void main(String[] args) 抛出异常 { 配置 conf = new Configuration(); ToolRunner.run(conf,new DriverDate(), args); } }【问题讨论】:
-
你能把你的main方法(或Driver类),以及你运行程序的命令贴出来吗?
-
没有其他额外配置,我确定我运行的 jar 是正确的。
-
那么,我没有答案……等着别人……抱歉,祝你好运!
-
映射后数据的大小(中间数据)是多少?如果手动设置reduce为1,reduce阶段有重试吗?
-
Abdulrahman,我找到了答案,你是对的,将减速器的数量明确设置为一个是解决问题的一种方法