在上篇文章中eclipse已经能访问HDFS目录,但并不能进行Mapreduce编程,在这里小编将常见错误和处理办法进行总结,希望对大家有所帮助
错误1:ERROR [main] util.Shell (Shell.java:getWinUtilsPath(303)) - 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.
解决办法:
eg:我解压的目录是D:\hadoop-2.6.0
在系统的环境变量界面添加HADOOP_HOME,并在系统变量PATH中添加如图:
然后eclipse中选择Windows->Prefenences设置如图:
错误2:Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
错误3:Exception in thread "main" java.lang.UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/lang/String;I)Z
上面两个问题是缺少组件,解决办法:
下载hadoop-common-2.2.0-bin-master
将里边bin 目录替换 本地hadoop里边的bin目录
错误:4:
15/08/03 10:15:43 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
15/08/03 10:15:43 INFO client.RMProxy: Connecting to ResourceManager at /0.0.0.0:8032
15/08/03 10:15:55 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
15/08/03 10:15:57 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
15/08/03 10:15:59 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
解决办法:
将集群配置文件中core-site.xml localhost改为你主节点IP
然后加入在yarn-site.xml中加入
<property>
<name>yarn.resourcemanager.address</name>
<value>127.0.0.1:8032</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>127.0.0.1:8030</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>127.0.0.1:8031</value>
</property>
<property>
<name>yarn.resourcemanager.hostname</name>
<value>127.0.0.1</value>
</property>
注意127.0.0.1改为你的ip
特别注意的是,修改后,集群要重新启动,且把里边的修改的文件重新copy一份到程序的src目录下,在eclipse中刷新
错误5:
Exit code: 1
Exception message: /bin/bash: 第 0 行: fg: 无任务控制
Stack trace: ExitCodeException exitCode=1: /bin/bash: 第 0 行: fg: 无任务控制
解决办法参考网上给的教程:http://www.aboutyun.com/thread-8498-1-1.html 并未解决
真正的办法是:
在客户端配置文件中添加如下属性:
<property> <name>mapreduce.app-submission.cross-platform</name> <value>true</value> </property>
注意:必须添加到Hadoop程序读取的客户端本地配置文件中,添加到客户端Hadoop安装路径中的“core-site.xml”,“mapred-site.xml”等文件中不起作用
推荐一篇不错的博客:http://www.aboutyun.com/thread-8311-1-1.html
版权声明:本文为博主原创文章,未经博主允许不得转载。