首先跑一下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程序的部分的話,后續有時間再補吧。
新聞熱點
疑難解答