用eclipse开发hadoop入门程序wordcount

首先用maven构建项目框架,然后写完code之后(详见:http://www.cnblogs.com/flying5/archive/2011/05/04/2078408.html),采用maven package打包成jar包:wordcount.jar。然后拷贝到布置好的hadoop服务器上。

构建输入数据:

hadoop fs -put input1.txt ./input/wordcount

hadoop fs -put input2.txt ./input/wordcount

运行job即可:

hadoop jar wordcount.jar com.*.wordcount.job.JobRunner ./input/wordcount ./output/wordcount

运行完之后,查看结果:

hadoop fs -ls ./output/wordcount

会发现有文件part-00000

hadoop fs -cat ./output/wordcount/part-00000

就可以看到hadoop结果了。

原文地址:https://www.cnblogs.com/tandychao/p/2916900.html