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上將其替換
相關文章
相關標籤/搜索