赞
踩
在上篇文章中eclipse已经能访问HDFS目录( blog.csdn.net/gamer_gyt/article/details/47209623),但并不能进行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”等文件中不起作用
错误6:
正确放置完jar插件之后,eclipse中不能显示mapreduce
解决办法:检查jar插件的位置注意如果是从ubuntu自带的软件中心安装elcipse的话,则安装目录为:/usr/share/eclipse/dropins/sdk/plugins/不是在/usr/share/eclipse/plugin,进入eclipse目录,执行sudo chmod 777 * -R,重启eclipse 这一步特别重要网上好多资料都不是这样写的,所以配置一直不成功。
推荐一篇不错的博客:http://www.aboutyun.com/thread-8311-1-1.html
扫一扫 关注微信公众号!号主 专注于搜索和推荐系统,尝试使用算法去更好的服务于用户,包括但不局限于机器学习,深度学习,强化学习,自然语言理解,知识图谱,还不定时分享技术,资料,思考等文章!
【技术服务】,详情点击查看:https://mp.weixin.qq.com/s/PtX9ukKRBmazAWARprGIAg
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。