hadoop運行wordcount

hadoop版本爲2.7.2html

部署請參考:http://www.javashuo.com/article/p-fpqetctu-ck.htmloop

準備工做須要以下: 1.hadoop環境
2.example.jar
3.指定輸入輸出目錄.net

(一)example.jar位置

hadoop-mapreduce-examples-2.7.2.jar 路徑在hadoop安裝目錄下code

ls -l share/hadoop/mapreduce/ http://7xwsew.com1.z0.glb.clouddn.com/hadoop-002-001.jpghtm

(二)輸入輸出路徑,上傳什麼文件

1.HDFS建立數據目錄blog

建立輸入文件位置:hadoop fs -mkdir -p /data/wordcount 建立輸出文件位置:hadoop fs -mkdir -p /output/ 查看當前文件列表:hadoop fs -ls / http://7xwsew.com1.z0.glb.clouddn.com/hadoop-002-002.jpghadoop

2.添加輸入文件部署

這裏構建好文本inputword http://7xwsew.com1.z0.glb.clouddn.com/hadoop-002-003.jpg 將文件上傳到HDFS當中並查看
hadoop fs -put ~/inputWord /data/wordcount/ hadoop fs -ls /data/wordcount http://7xwsew.com1.z0.glb.clouddn.com/hadoop-002-004.jpgget

(三)運行wordcount

經過運行jar 並傳遞執行參數運行wordcount
hadoop jar /usr/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar wordcount /data/wordcount /output/wordcount
http://7xwsew.com1.z0.glb.clouddn.com/hadoop-002-005.jpg http://7xwsew.com1.z0.glb.clouddn.com/hadoop-002-006.jpg
查看結果,執行以下命令,與輸入文件吻合
hadoop fs -text /output/wordcount/part-r-00000 http://7xwsew.com1.z0.glb.clouddn.com/hadoop-002-007.jpginput

HDFS命令參考:http://www.cnblogs.com/xd502djj/p/3625799.html 參考:http://www.aboutyun.com/blog-61-148.html

相關文章
相關標籤/搜索