我正在关注Cloudera Tutorial并做“4.使用spark-submit提交申请”。我做错了什么,以便运行教程失败?我发现spark-shell和spark-submit,但不是/ bin文件夹中的Spark-slass。
https://codesandbox.io/s/313vmr23k6
export SPARK_HOME="/opt/cloudera/parcels/CDH"
spark-submit --master local[2] --conf
"spark.dynamicAllocation.enabled=false" --jars
$SPARK_HOME/lib/spark/lib/spark-examples.jar kafka_wordcount_keke.py k
localhost:2181 POCTopicKeke1
[Myadmin@Myclouderadatahub-mn0 lib]$ spark-submit --master local[2] --jars $SPARK_HOME/lib/spark/lib/spark-examples.jar kafka_wordcount_keke.py localhost:2181 POCTopicKeke1
/log/cloudera/parcels/CDH-5.12.1-1.cdh5.12.1.p0.3/bin/../lib/spark/bin/spark-submit: line 27: /opt/cloudera/parcels/CDH/bin/spark-class: No such file or directory
/log/cloudera/parcels/CDH-5.12.1-1.cdh5.12.1.p0.3/bin/../lib/spark/bin/spark-submit: line 27: exec: /opt/cloudera/parcels/CDH/bin/spark-class: cannot execute: No such file or directory
[Myadmin@Myclouderadatahub-mn0 lib]$
答案 0 :(得分:2)
我遇到了与CDH 5.13和Spark2.2相似的问题
/opt/cloudera/parcels/SPARK2-2.2.0.cloudera1-1.cdh5.12.0.p0.142354/bin/../lib/spark2/bin/pyspark: line 77: /opt/cloudera/parcels/SPARK2/bin/spark-submit: No such file or directory
经过调查,我发现我在/etc/profile
手动将SPARK_HOME设置为
export SPARK_HOME=/opt/cloudera/parcels/SPARK2
甚至在评论它并重新加载/etc/profile
之后它就无法正常工作。
<强>解决方案强>:
env
命令显示SPARK_HOME
仍然设置(奇怪),因此我使用以下命令取消设置SPARK_HOME
unset SPARK_HOME
它开始工作了。
答案 1 :(得分:0)
面对Spark 2.4.4的类似问题:
bin/spark-submit --version
bin/spark-submit: line 27: /some/path/spark-2.4.4-bin-hadoop2.7
/some/path/spark-2.4.4-bin-hadoop2.7/bin/spark-class: No such file or directory
bin/spark-submit: line 27: exec: /some/path/spark-2.4.4-bin-hadoop2.7
/some/path/spark-2.4.4-bin-hadoop2.7/bin/spark-class: cannot execute: No such file or directory
解决方案:定义SPARK_HOME(对我而言尚未定义)
export SPARK_HOME=/some/path/spark-2.4.4-bin-hadoop2.7
答案 2 :(得分:0)
在 CDH 上遇到同样的问题。
问题的关键是CDH已经在spark-env.sh上指定了SPARK_HOME方向。它将覆盖检测到的 linux 环境变量。
如果公司不允许使用“/opt”安装CDH的spark客户端。它应该更改 spark-env.sh 上的 HADOOP_HOME 和 SPARK_HOME。
export SPARK_HOME=/home/Unionpay_Xzb/CDH/lib/spark
SPARK_PYTHON_PATH=""
if [ -n "$SPARK_PYTHON_PATH" ]; then
export PYTHONPATH="$PYTHONPATH:$SPARK_PYTHON_PATH"
fi
export HADOOP_HOME=/home/Unionpay_Xzb/CDH/lib/hadoop
export HADOOP_COMMON_HOME="$HADOOP_HOME"
不会发生检测到的用户定义的 SPARK_HOME 覆盖!