首先跑一下Hadoop自己带的world count。
先得上传文件到HDFS。
hadoop fs -mkdir -p /Wordcount/inputhadoop fs -put GitHubLog.txt /wordcount/input然后运行
hadoop jar /root/apps/hadoop-2.7.3/share/hadoop/maPReduce/hadoop-mapreduce-examples-2.7.3.jar wordcount /wordcount/input/ /wordcount/output其中 /wordcount/output 是结果的输出目录,要求不存在。
在这一步还出了问题,结果是之前的集群没配好。之前那篇配置Hadoop的博客已经修正了。
使用下面的命令查看结果:
hadoop fs -cat /wordcount/output/part-r-00000
一部分结果是:
extracted 4failed. 2failed: 2fatal: 2fetch 1file 3file; 2filters 1find 2for 11from 4get 1git 3git.c:371 2github 1github.com 6自己写MapReduce程序的部分的话,后续有时间再补吧。
新闻热点
疑难解答