MapReduce编程实战(1)--实现wordcount词频统计
摘要: 一个WordCount单词统计程序为实例,详细演示了如何编写MapReduce程序代码以及如何打包运行程序。 参考资料: Api 文档地址: http://hadoop.apache.org/docs/current/api/index.html maven资源库: https://mvnrepository.com/repos/central 用于配置pom的时候查询资源 1.创建maven项目 创建maven项目,项目名hdfs ##这里我用的文章“java操作hdfs”的项目hdfs pom.xml文件: //与文章“java操作hdfs”的项目一样。 2.编写WordCount类 在该项目包com.scitc.hdfs中新建WordCount.java类,代码如下: package com.scitc.hdfs; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import