Spark Yarn客户端模式:Spark上下文在等待后端时停止

时间:2019-03-30 17:38:50

标签: docker apache-spark kubernetes yarn jupyterhub

我们在纱线簇上产生火花,我一直在尝试从客户端内部的jupyterhub在客户端模式下创建sparkcontext。 Docker在与hadoop集群相同的主机网络中运行。我看到以下错误,不知道可能是什么问题。

from pyspark import SparkConf
from pyspark import SparkContext

conf = SparkConf()
conf.setMaster('yarn')
conf.setAppName('spark-yarn')
conf.set('spark.driver.bindaddress','<the host ip which docker is running on>')
conf.set("spark.driver.memory", "512M") 
conf.set("spark.executor.memory", "512M")
sc = SparkContext(conf=conf)

错误是:

Py4JJavaError: An error occurred while calling None.org.apache.spark.api.java.JavaSparkContext.
: java.lang.IllegalStateException: Spark context stopped while waiting for backend
    at org.apache.spark.scheduler.TaskSchedulerImpl.waitBackendReady(TaskSchedulerImpl.scala:745)
    at org.apache.spark.scheduler.TaskSchedulerImpl.postStartHook(TaskSchedulerImpl.scala:191)
    at org.apache.spark.SparkContext.<init>(SparkContext.scala:560)
    at org.apache.spark.api.java.JavaSparkContext.<init>(JavaSparkContext.scala:58)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:247)
    at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
    at py4j.Gateway.invoke(Gateway.java:238)
    at py4j.commands.ConstructorCommand.invokeConstructor(ConstructorCommand.java:80)
    at py4j.commands.ConstructorCommand.execute(ConstructorCommand.java:69)
    at py4j.GatewayConnection.run(GatewayConnection.java:238)
    at java.lang.Thread.run(Thread.java:748)

0 个答案:

没有答案