天天看点

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

继续阅读