我設定了 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://
主網址,它會拋出No FileSystem for scheme: local
例外。
RBAC是根據上面的URL配置的,所有pod都使用spark
service account。
我沒主意了。