您的位置:首页 > 大数据 > Hadoop

运行hadoop自带示例程序wordcount

2019-05-23 10:20 162 查看

运行hadoop自带示例程序wordcount

创建 a.txt

[hadoop@spark1 ~]$ vim a.txt 

spark   hadoop  spark
hadoop  yarn    resouremanager
yarn
hadoop

创建 b.txt

[hadoop@spark1 ~]$ 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

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: