天天看點

ubuntu hadoop2.6.1,terminal下運作wordcount

cd ~ 指令是進入root檔案夾下進行操作,不建議如此,自定義檔案夾路徑更好。前五步僅供參考,若自定義檔案夾則需要修改後續涉及到的路徑

[email protected]:/usr/local/hadoop# cd ~

[email protected]:~# mkdir file

[email protected]:~# cd file

[email protected]:~/file# echo "Hello World" > file1.txt

[email protected]:~/file# echo "Hello World" > file2.txt

[email protected]:~/file# cd /usr/local/hadoop  (有些人在此處的目錄可能是hadoop-2.6.0或hadoop-2.6.1,其實就是hadoop的安裝目錄)

[email protected]:/usr/local/hadoop# bin/hadoop fs -mkdir /input

[email protected]:/usr/local/hadoop# bin/hadoop fs -put ~/file/file*.txt /input

[email protected]:/usr/local/hadoop# bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.1.jar wordcount /input/ /output

檢視結果

# bin/hdfs dfs -cat /output/*

ubuntu hadoop2.6.1,terminal下運作wordcount

參考資料中有些許錯誤,在本文中得到改正

http://www.cnblogs.com/HouZhiHouJueBlogs/p/3977826.html

http://www.itnose.net/detail/6197823.html

繼續閱讀