2

我有一个 HA 模式下的独立 spark 集群(2 个主节点)和几个在那里注册的工人。

我通过 REST 接口提交了火花作业,并提供了以下详细信息,

{
    "sparkProperties": {
        "spark.app.name": "TeraGen3",
        "spark.default.parallelism": "40",
        "spark.executor.memory": "512m",
        "spark.driver.memory": "512m",
        "spark.task.maxFailures": "3",
        "spark.jars": "file:///tmp//test//spark-terasort-1.1-SNAPSHOT-jar-with-dependencies.jar",
        "spark.eventLog.enabled": "false",
        "spark.submit.deployMode": "cluster",
        "spark.driver.supervise": "true",
        "spark.master": "spark://spark-hn0:7077,spark-hn1:7077"
    },
    "mainClass": "com.github.ehiggs.spark.terasort.TeraGen",
    "environmentVariables": {
        "SPARK_ENV_LOADED": "1"
    },
    "action": "CreateSubmissionRequest",
    "appArgs": ["4g", "file:///tmp/data/teradata4g/"],
    "appResource": "file:///tmp//test//spark-terasort-1.1-SNAPSHOT-jar-with-dependencies.jar",
    "clientSparkVersion": "2.1.1"
}

此请求通过 REST 接口 ( http://spark-hn1:6066/v1/submissions/create ) 提交给 Active Spark Master。

当驱动程序启动时,-Dspark.master 设置为“spark://spark-hn1:7077”,而不是 sparkProperties 中传递的值,即“spark://spark-hn0:7077,spark-hn1:7077 ”。

来自运行驱动程序的工作节点的日志

17/12/18 13:29:49 INFO worker.DriverRunner: Launch Command: "/usr/lib/jvm/java-8-openjdk-amd64/bin/java" "-Dhdp.version=2.6.99.200-0" "-cp" "/usr/hdp/current/spark2-client/conf/:/usr/hdp/current/spark2-client/jars/*:/etc/hadoop/conf/" "-Xmx512M" "-Dspark.driver.memory=51
2m" "-Dspark.master=spark://spark-hn1:7077" "-Dspark.executor.memory=512m" "-Dspark.submit.deployMode=cluster" "-Dspark.app.name=TeraGen3" "-Dspark.default.parallelism=40" "-Dspark.jars=file:///tmp//test//spark-terasort-1.1-SNAPSHOT-jar-with-dependencies.jar" "-Dspark.ta
sk.maxFailures=3" "-Dspark.driver.supervise=true" "-Dspark.eventLog.enabled=false" "org.apache.spark.deploy.worker.DriverWrapper" "spark://Worker@172.18.0.4:40803" "/var/spark/work/driver-20171218132949-0001/spark-terasort-1.1-SNAPSHOT-jar-with-dependencies.jar" "com.git
hub.ehiggs.spark.terasort.TeraGen" "4g" "file:///tmp/data/teradata4g/"

当活动主机在作业执行期间关闭并且另一个主机变为活动时,这给我带来了问题。由于驱动程序只知道一个主控(旧主控),因此无法到达新主控并继续执行作业(因为 spark.driver.supervise=true)

在 Spark REST 接口中传递多个主 url 的正确方法是什么。

4

1 回答 1

0

看起来这是 RestServer 实现中的一个错误,其中 spark.master 正在被替换。 https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/deploy/rest/StandaloneRestServer.scala#L147

我们仍然可以通过在通过 REST 接口提交作业时在 spark.driver.extraJavaOptions 中设置 spark.master 来解决此问题,如下所示

"sparkProperties": {
        "spark.app.name": "TeraGen3",
        ...
        "spark.driver.extraJavaOptions": "-Dspark.master=spark://spark-hn0:7077,spark-hn1:7077"
    }

这对我有用。

于 2017-12-20T11:52:37.903 回答