使用Eclipse编译运行MapReduce程序 Hadoop2.7.3
1.安装hadoop、eclipse
2.配置Eclipse
主要参考博客:http://www.powerxing.com/hadoop-build-project-using-eclipse/
2.1安装Hadoop-Eclipse-Plugin
Hadoop-Eclipse-Plugin2.7.3下载地址:http://download.csdn.net/detail/tondayong1981/9668289?locationNum=3&fps=1
将hadoop-eclipse-kepler-plugin-2.6.0.jar 复制到 Eclipse 安装目录的 plugins 文件夹中
运行:/usr/bin/eclipse -clean
之后操作在http://www.powerxing.com/hadoop-build-project-using-eclipse/中详细描述,且有截图讲解。
3.遇到问题
3.1The constructor Job(Configuration,String) is deprecated
Job job = new Job(conf,”word count”);
改为:
Job job = Job.getInstance(conf, “word count”);
3.2 Input path does not exist
通过打开MapReduceLocattion中的文件,确认其文件名更改文件位置
main函数中修改
FileInputFormat.addInputPath(job,new Path(“hdfs://192.168.108.201:9000/user/hadoop/input”));
FileOutputFormat.setOutputPath(job, new Path(“hdfs://192.168.108.201:9000/user/hadoop/output”));
3.3output文件冲突
直接在eclipse中右键删除就可以了