开发者学堂课程【Hadoop 分布式计算框架 MapReduce:WordCount 案例 Driver】学习笔记,与课程紧密联系,让用户快速学习知识。
课程地址:https://developer.aliyun.com/learning/course/94/detail/1484
WordCount 案例 Driver
WordCount案例Driver
import
org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import
org.apache.hadoop.mapreduce.lib.output.FileoutputFormat;
public class wordcountDriver {
public static void main (string[] args) throws IOException,ClassNotFoundException,InterruptedException {
// 1获取配置信息以及封装任务
Configuration configuration = new Configuration ( );
Job job = Job.getInstance (configuration) ;
//2设置 jar 加载路径
job.setJarByClass (wordcountDriver.class) ;
//3设置 map 和 reduce 类
job.setMapperClass (wordcountMapper.class);
job.setReducerClass(wordcountReducer.class) ;
//4设置 map 输出
job.setMapoutputKeyClass (Text.class) ;
job.setMapoutputValueClass (Intwritable.class);