码迷,mamicode.com
首页 > 其他好文 > 详细

运行hadoop自带的wordcount例子程序

时间:2018-11-15 00:22:38      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:运行   mapr   程序   dir   htm   结果   tput   text   ext   

1.准备文件
[root@master ~]# cat input.txt
hello java
hello python
hello c
hello java
hello js
hello html
hello java
[root@master ~]# hadoop fs -mkdir /input
[root@master ~]# hadoop fs -put input.txt /input
[root@master ~]# hadoop fs -ls /input
Found 1 items
-rw-r--r-- 2 root supergroup 74 2018-11-14 21:42 /input/input.txt

2.例子程序位置
/usr/local/hadoop-2.7.3/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.3.jar

3.运行
[root@master ~]# hadoop jar hadoop-mapreduce-examples-2.7.3.jar wordcount /input/input.txt /output
[root@master ~]# hadoop fs -ls /output/
Found 2 items
-rw-r--r-- 2 root supergroup 0 2018-11-14 21:46 /output/_SUCCESS
-rw-r--r-- 2 root supergroup 40 2018-11-14 21:46 /output/part-r-00000

4.查看结果
[root@master ~]# hadoop fs -text /output/part-r-00000
c 1
hello 7
html 1
java 3
js 1
python 1

运行hadoop自带的wordcount例子程序

标签:运行   mapr   程序   dir   htm   结果   tput   text   ext   

原文地址:https://www.cnblogs.com/413xiaol/p/9961028.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!