在 stackoverflow 找到的方案
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 ]; thenexport JAVA_HOME=($(/usr/libexec/java_home))
elseexport JAVA_HOME=(/Library/Java/Home)
fi
to
if [ -x /usr/libexec/java_home ]; then// note that the extra parentheses are removedexport JAVA_HOME=$(/usr/libexec/java_home)
elseexport JAVA_HOME=/Library/Java/Home
fi
然后重启yarn
但我用的是版本时 3.2.2
hadoop-config.sh 脚本重构过,在以下三个方法中,没找到上面要改的地方。所以直接在后面追加 JAVA_HOME。 然后重启yarn, 亲测可用