运行hadoop自带示例程序wordcount

创建 a.txt

[[email protected] ~]$ vim a.txt 

spark   hadoop  spark
hadoop  yarn    resouremanager
yarn
hadoop

创建 b.txt

[[email protected] ~]$ vim b.txt 

1001    aaa
1002    bbb
hadoop
hadoop1

创建 wordcount/input hdfs的目录

hadoop fs -mkdir -p  /wordcount1/input1

将 a.txt 和 b.txt 上传到  hdfs 的 wordcount/input

hadoop fs -put a.txt /wordcount/input

hadoop fs -put b.txt /wordcount/input

运行自带wordcount程序

hadoop jar hadoop-mapreduce-examples-2.7.7.jar wordcount /wordcount/input /output

查看运行结果

hadoop fs -cat /output/part-r-00000

运行hadoop自带示例程序wordcount

相关文章: