我正在尝试在纱线集群模式下运行应用程序。以下是 shell 脚本的设置:
spark-submit --class "com.Myclass"
--num-executors 2
--executor-cores 2
--master yarn
--supervise
--deploy-mode cluster
../target/
此外,我收到以下错误。 以下是来自纱线日志应用程序ID的错误详细信息
INFO : org.apache.spark.deploy.yarn.ApplicationMaster - Registered signal handlers for [TERM, HUP, INT]
DEBUG: org.apache.hadoop.util.Shell - Failed to detect a valid hadoop home directory
java.io.IOException: HADOOP_HOME or hadoop.home.dir are not set.
at org.apache.hadoop.util.Shell.checkHadoopHome(Shell.java:307)
at org.apache.hadoop.util.Shell.<clinit>(Shell.java:332)
at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:79)
at org.apache.hadoop.yarn.conf.YarnConfiguration.<clinit>(YarnConfiguration.java:590)
at org.apache.spark.deploy.yarn.YarnSparkHadoopUtil.newConfiguration(YarnSparkHadoopUtil.scala:62)
at org.apache.spark.deploy.SparkHadoopUtil.<init>(SparkHadoopUtil.scala:52)
at org.apache.spark.deploy.yarn.YarnSparkHadoopUtil.<init>(YarnSparkHadoopUtil.scala:47)
我尝试修改 spark-env.sh,如下所示,我看到Hadoop_Home记录但仍然出现上述错误。修改了以下条目并将其添加到 spark-env.sh
export HADOOP_HOME="/usr/lib/hadoop"
echo "&&&&&&&&&&&&&&&&&&&&&& HADOOP HOME "
echo "$HADOOP_HOME"
export HADOOP_CONF_DIR="$HADOOP_HOME/etc/hadoop"
echo "&&&&&&&&&&&&&&&&&&&&&& HADOOP_CONF_DIR "
echo "$HADOOP_CONF_DIR"
当我运行火花提交时,我看到hadoop home记录了,但它仍然抱怨hadoop-home。
在我的
spark-env.sh 中,它看起来有点不同:
# Make Hadoop installation visible
export HADOOP_HOME=${HADOOP_HOME:-/usr/hdp/current/hadoop-client}
export HADOOP_CONF_DIR=${HADOOP_CONF_DIR:-/etc/hadoop/conf}
也许这可以帮助你。请记住调整路径。