hadoop运行简单例子--单词统计

前提是已经搭建好了Hadoop平台:如下

hadoop运行简单例子--单词统计hadoop运行简单例子--单词统计hadoop运行简单例子--单词统计

hadoop运行简单例子--单词统计


第一步:创建HDFS目录:


文件输入目录: hadoop fs -mkdir -p /csz/wordcount/input

hadoop运行简单例子--单词统计

第二步:新建数据文件:

myword

I thought a thought. But the thought I thought wasn't the thought I thought I thought. If the thought I thought I thought had been the thought I thought, I wouldn't have thought so much.

hadoop运行简单例子--单词统计

将文件遇到hdfs文件中:

hadoop运行简单例子--单词统计

运行wordcount程序:

./hadoop jar ../share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.3.jar wordcount /csz/wordcount/input /csz/wordcount/output

hadoop运行简单例子--单词统计

hadoop运行简单例子--单词统计

查看统计结果:

hadoop运行简单例子--单词统计