Mapreduce程序WordCount
参考:
http://www.cnblogs.com/xia520pi/archive/2012/05/16/2504205.html
http://www.cnblogs.com/taven/archive/2012/11/03.html
http://luluq1987.blog.163.com/blog/static/40790681201121934352484/
http://luluq1987.blog.163.com/blog/static/407906812011267347477/
程序源码:
Tips: 不同版本的hadoop的WordCount可能不同,存在一些过期的接口或类,本版本是2.20.2版本,最好找自己版本的例子做参考,Wordcount在hadoop目录的 src/org/apache/hadoop/examples中
package com.ptrdu.test;
import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.GenericOptionsParser;
public class WordCount {
public static class TokenizerMapper
extends Mapper<Object, Text, Text, IntWritable>{
private final static IntWritable one = new IntWritable(1);
private Text word = new Text();
public