Spark:Pi 示例在集群模式下抛出 NoSuchFileException

Spark:Pi 示例在集群模式下抛出 NoSuchFileException

我建立了一个 Spark 2.3.1 集群,但是在向其发送示例 SparkPi 作业时遇到了问题:

Running Spark using the REST application submission protocol.
2018-09-06 13:45:53 INFO  RestSubmissionClient:54 - Submitting a request to launch an application in spark://10.0.15.7:7077.
2018-09-06 13:46:04 WARN  RestSubmissionClient:66 - Unable to connect to server spark://10.0.15.7:7077.
Warning: Master endpoint spark://10.0.15.7:7077 was not a REST server. Falling back to legacy submission gateway instead.
2018-09-06 13:46:04 WARN  NativeCodeLoader:62 - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
2018-09-06 13:46:10 ERROR ClientEndpoint:70 - Exception from cluster was: java.nio.file.NoSuchFileException: /opt/spark/examples/jars/spark-examples_2.11-2.3.1.jar
java.nio.file.NoSuchFileException: /opt/spark/examples/jars/spark-examples_2.11-2.3.1.jar
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
    at sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:526)
    at sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:253)
    at java.nio.file.Files.copy(Files.java:1274)
    at org.apache.spark.util.Utils$.org$apache$spark$util$Utils$$copyRecursive(Utils.scala:632)
    at org.apache.spark.util.Utils$.copyFile(Utils.scala:603)
    at org.apache.spark.util.Utils$.doFetchFile(Utils.scala:688)
    at org.apache.spark.util.Utils$.fetchFile(Utils.scala:485)
    at org.apache.spark.deploy.worker.DriverRunner.downloadUserJar(DriverRunner.scala:155)
    at org.apache.spark.deploy.worker.DriverRunner.prepareAndRunDriver(DriverRunner.scala:173)
    at org.apache.spark.deploy.worker.DriverRunner$$anon$1.run(DriverRunner.scala:92)

我正在使用的提交脚本:

bin/spark-submit \
    --master spark://10.0.15.7:7077 \
    --deploy-mode cluster \
    --name spark-pi \
    --class org.apache.spark.examples.SparkPi \
    --conf spark.kubernetes.container.image=gcr.io/my-project/spark:spark-test \
    --conf spark.kubernetes.authenticate.driver.serviceAccountName=spark \
    --conf spark.executor.instances=3 \
    /opt/spark/examples/jars/spark-examples_2.11-2.3.1.jar 1000

gcr.io/my-project/spark:spark-test使用默认设置构建了图像

bin/docker-image-tool.sh -r gcr.io/my-project -t spark-test build push

/opt/spark/examples/jars/spark-examples_2.11-2.3.1.jar容器中也是如此。确认了这一点:

docker run --rm -it --entrypoint "/bin/ls" gcr.io/my-project/spark:spark-test -l /opt/spark/examples/jars/

我的 Spark 集群在 Kubernetes 上运行。我使用的是spark://方案,而不是新k8s://https://方案,因此它应该像常规 Spark 集群一样工作。IP 和端口可见,包括 Spark Web UI。

我不明白它在哪里寻找 jar 文件。

我尝试在路径前面添加local://,如在 Spark 示例中所示: https://spark.apache.org/docs/2.3.1/running-on-kubernetes.html 但它不适用于spark://主 url,它会引发No FileSystem for scheme: local异常。

根据上面的URL配置RBAC,所有pod都使用spark服务账户。

我没什么主意了。

相关内容