1. 下载hadoop eclipse plugin:
2. 把plugin的jar包放到eclipse的plugin的目录下面
3. 重启eclipse,打开windows-》openperspective-》map/reduce 可以看到map/reduce开发视图
4. “new hadoop location” , location name 框随便填写 , host写namenode的地址,port写配置里面相应的配置
5. 可以通过new选项生成mapper,reducer,map/reduce project 三种内容
6. 如果要通过eclipse里面运行基于hadoop开发的程序(不用把jar文件拷贝到master,然后运行hadoop jar命令运行程序),而且调用了集群的hadoop,则需要在程序中加入以下代码,如果在添加以下代码的基础上,
仍然遇到了permission denied的问题,那么就是你hdfs上文件的读写权限不够,通过命令:hadoop dfs -chmod 777 filename 修改读写权限
Configuration conf = new Configuration();
// Ensure that eclipse has the permission do execute the project in
// hadoop
// Setting user name
conf.set("user.name", "hadoop");
// Setting user and password. In this case, "hadoop" is user and "jtang"
// is password
conf.set("hadoop.job.ugi", "hadoop,jtang");