自己实现Combiner
package com.mapreduce; import java.io.IOException; import org.apache.hadoop.examples.SecondarySort.Reduce; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Reducer; public class MyCombiner extends Reducer<Text, Text, Text, Text>{ @Override protected void reduce(Text key, Iterable<Text> value, Context context) throws IOException, InterruptedException { /** * 接受到的数据格式 * key value * hadoop_1.html 1 * hadoop_1.html 1 * * 输出的数据格式 * key value * hadoop 1.html:3 * */ String string = key.toString(); String[] split = string.split("_"); int count = 0; for (Text t : value) { count+=Integer.parseInt(t.toString()); } context.write(new Text(split[0]), new Text(split[1]+":"+count+"")); } } package com.mapreduce; import java.io