Windows Eclipse Hadoop 开发

1. eclipse添加hadoop-eclipse-plugin插件

下载: hadoop2x-eclipse-pluginjava

Hadoop-2.5.2和hadoop-2.6.4版本选择hadoop-eclipse-plugin-2.6.0.jar(亲测可用) 
将hadoop-eclipse-plugin-2.6.0.jar拷贝到eclipse\plugins下 
重启eclipsegit

eclipse.exe -cleangithub

这时,在eclipse Project Explorer视图下,能看到,多出了DFS Locations apache


DFS 

 

2. eclipse 设置Hadoop Map/Reduce Locations

Windows -> Preferences windows


hadoop map/reduce 


Windows -> Perspective -> Open Perspective -> Other… 选中 Map/Reduce eclipse


map/reduce perspective 


进入Map/Reduce视图,新建 Hadoop location… oop


Map/Reduce Location


设置集群地址 测试


edit hadoop location 

 

3. Windows 本地配置

下载64位的hadoop2.6版本插件,放在某一目录的bin目录下(必定要为bin目录) spa


bin 


下载: hadoop2.6-x64.net

 

将其中的hadoop.dll 拷贝至 C:\Windows\System32目录下 


system32 

 

4. 工程配置

新建MapReduce工程 


mapreduce project 


将集群中hadoop-2.6.4/etc/hadoop下的配置文件拷贝到工程下 


site file 


利用hadoop-wiki例子:WordCount

 

测试: 
代码添加设置系统属性”hadoop.home.dir”,value值为第三步设置bin目录的父目录。

System.setProperty("hadoop.home.dir", "D:\\hadoop\\hadoop2.6-x64" );
  • 1
  • 1

5. 常见错误

  1. Exceptionin thread “main” java.lang.UnsatisfiedLinkError:org.apache.hadoop.util.NativeCrc32.nativeComputeChunkedSumsByteArray(II[BI[BIILjava/lang/String;JZ)V 这是hadoop.dll 版本问题,2.4以前的版本和以后的使用hadoop.dll不同  解决:须要选择正确的版本而且在 hadoop\bin和 C:\windows\system32上将其替换
相关文章
相关标签/搜索