【总结】Hadoop中的Combiner实践
Combiner作用是合并Mapper的输出,Combiner的输出作为Reducer的输入,这样可以减少map任务和reducer任务之间的数据传输。 1、在Job中设置Combiner和不设置Combiner,观察Reducer输入情况 使用如下代码设置Combiner job.setCombinerClass(MaxTemperatureReducer.class); @Override public int run(String[] args) throws Exception { Job job = new Job(); job.setJarByClass(MaxTemperature.class); job.setJobName("Max temperature"); FileInputFormat.addInputPath(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.setMapperClass(MaxTemperatureMapper.class...