赞
踩
This answer is applicable for Hadoop version 2.6.0 and earlier. Disabling SIP and creating a symbolic link does provide a workaround. A better solution is to fix the hadoop-config.sh so it picks up your JAVA_HOME correctly
In HADOOP_HOME/libexec/hadoop-config.sh
look for the if condition below # Attempt to set JAVA_HOME if it is not set
Remove extra parentheses in the export JAVA_HOME lines as below. Change this
- if [ -x /usr/libexec/java_home ]; then
- export JAVA_HOME=($(/usr/libexec/java_home))
- else
- export JAVA_HOME=(/Library/Java/Home)
- fi
to
- if [ -x /usr/libexec/java_home ]; then
- // note that the extra parentheses are removed
- export JAVA_HOME=$(/usr/libexec/java_home)
- else
- export JAVA_HOME=/Library/Java/Home
- fi
Restart yarn after you have made this change.
More detailed info can be found here https://issues.apache.org/jira/browse/HADOOP-8717 and seems that Hadoop 3.0.0-alpha1 is the first release with the fix.
方法二
试了以上几种方法后依然无法解决问题,然后在链接4的评论下又看到一篇文章,说能真正解决这个问题,因为以前遇到过这个问题,依稀记得当时是重启电脑输入什么命令后解决的,然后点进去链接看到文章里果然有我的评论,所以在此仅以此文记录下这个坑,以后再犯好找解决方法
以下是解决方法,参考这里:
1,重启电脑,进入恢复模式,打开终端
2,输入以下命令,禁用SIP特性,SIP特性大概是指即使拥有sudo权限也无法修改系统级目录的权限,默认为启用状态
csrutil disable
1
3,重启电脑,进入正常模式,打开终端
在输入建立java软连接的命令
sudo ln -s /usr/bin/java /bin/java
1
输入系统密码就OK了,到此,此错误成功解决
后续:由于担心disable了csrutil会对系统本身有什么影响,于是打算再次开启,测试流程如下
先重启电脑,再运行job,第一次失败,提示什么safe mode,第二次成功
再重启电脑,进入恢复模式,启用csrutil
csrutil enable
1
successfully enabled system integrity protection,please restart the machine for the change to take effect
1
再重启电脑,再运行job,第一次失败,提示什么safe mode,第二次成功
至此,得出hadoop环境已经正常。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。