hadoop官方wordcount示例
提供版本JDK1.8+Hadoop2.7.2
在hadoop-2.7.2文件下面创建一个input文件夹
[root@hadoop101 hadoop-2.7.2]$mkdir input
在wcinput文件下创建一个wc.input文件
[root@hadoop101 hadoop-2.7.2]cd input
[root@hadoop101 input]touch wc.input
编辑wc.input文件
[root@hadoop01 input]vim wc.input
# 文件内容
hadoop
mapreduce
yarn
yarn
wc.input文件加载到hdfs
[root@hadoop101 hadoop-2.7.2]hadoop fs -put input/ /tmp/
运行官方jar包
[root@hadoop101 hadoop-2.7.2]hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar wordcount /tmp/input/ /tmp/output/
查看wordcount统计词频
[root@hadoop101 hadoop-2.7.2]hadoop fs -cat /tmp/output/part-r-00000
# 统计内容
hadoop 1
mapreduce 1
yarn 2
7913

被折叠的 条评论
为什么被折叠?



