在Win7 環境使用Java API 上傳文件到 Hadoop2.x HDFS 問題統計

 

問題一:java

org.apache.hadoop.security.AccessControlException: org.apache.hadoop.security .AccessControlException: Permission denied: user=Administrator, access=WRITE, inode="hadoop": hadoop:supergroup:rwxr-xr-xnode

解決方案:linux

 在本地系統(WIN7)的環境變量或java JVM變量裏面添加HADOOP_USER_NAME,這個值具體等於多少看本身的狀況,之後會運行HADOOP上的Linux的用戶名。(修改完重啓eclipse,否則可能不生效)git

 參考資料:github

 http://www.linuxidc.com/Linux/2014-08/105335.htmapache

 http://www.linuxidc.com/Linux/2014-08/105335p2.htmwindows

 問題二:eclipse

WIN7下運行hadoop程序報:Failed to locate the winutils binary in the hadoop binary pathoop

2015-07-06 17:32:26,455 ERROR [main] util.Shell (Shell.java:getWinUtilsPath(336)) - Failed to locate the winutils binary in the hadoop binary path
java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
 at org.apache.hadoop.util.Shell.getQualifiedBinPath(Shell.java:318)
 at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:333)
 at org.apache.hadoop.util.Shell.<clinit>(Shell.java:326) 

解決方案:網站

1.下載winutils的windows版本

GitHub上,有人提供了winutils的windows的版本,項目地址是:https://github.com/srccodes/hadoop-common-2.2.0-bin ,直接下載此項目的zip包,下載後是文件名是hadoop-common-2.2.0-bin-master.zip,隨便解壓到一個目錄

2.配置環境變量

增長用戶變量HADOOP_HOME,值是下載的zip包解壓的目錄,而後在系統變量path裏增長$HADOOP_HOME\bin 便可。

再次運行程序,正常執行。

參考資料:

http://www.tuicool.com/articles/iABZJj 

 

ZOOM 雲視頻會議網站:http://www.zoomonline.cn/

相關文章
相關標籤/搜索