我有一个主集群和3个工人的Spark集群设置。我还在CentOS虚拟机上安装了Spark。我试图从本地虚拟机运行一个Spark shell,它将连接到主机,并允许我执行简单的Scala代码。所以,下面是我在本地虚拟机上运行的命令:如何远程运行Apache Spark shell?
bin/spark-shell --master spark://spark01:7077
shell运行到可以输入Scala代码的程度。它说执行者已被授予(x3 - 每个工人一个)。如果我偷看Master的UI,我可以看到一个正在运行的应用程序,Spark shell。所有工作人员都很活跃,使用了2/2个内核,并且为应用程序分配了512 MB(5 GB内存)。所以,我尝试执行下面的Scala代码:
sc.parallelize(1 to 100).count
不幸的是,该命令不起作用。外壳将只打印相同的警告不休:
INFO SparkContext: Starting job: count at <console>:13
INFO DAGScheduler: Got job 0 (count at <console>:13) with 2 output partitions (allowLocal=false)
INFO DAGScheduler: Final stage: Stage 0(count at <console>:13) with 2 output partitions (allowLocal=false)
INFO DAGScheduler: Parents of final stage: List()
INFO DAGScheduler: Missing parents: List()
INFO DAGScheduler: Submitting Stage 0 (Parallel CollectionRDD[0] at parallelize at <console>:13), which has no missing parents
INFO DAGScheduler: Submitting 2 missing tasts from Stage 0 (ParallelCollectionRDD[0] at parallelize at <console>:13)
INFO TaskSchedulerImpl: Adding task set 0.0 with 2 tasks
WARN TaskSchedulerImpl: Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient memory
WARN TaskSchedulerImpl: Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient memory
WARN TaskSchedulerImpl: Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient memory
继我研究这个问题,我已经证实,我现在用的主URL是相同的Web界面上的一个。我可以ping和ssh两种方式(集群到本地VM,反之亦然)。此外,我玩过执行器 - 内存参数(增加和减少内存)都无济于事。最后,我尝试禁用双方的防火墙(iptables),但我一直得到相同的错误。我正在使用Spark 1.0.2。
TL; DR是否可以远程运行Apache Spark shell(并且本能地远程提交应用程序)?如果是这样,我错过了什么?
编辑:我接过一看,工人日志,发现工人们已经很难找到星火:
ERROR org.apache.spark.deploy.worker.ExecutorRunner: Error running executor
java.io.IOException: Cannot run program "/usr/bin/spark-1.0.2/bin/compute-classpath.sh" (in directory "."): error=2, No such file or directory
...
星火安装在不同的目录在我的本地虚拟机超过群集上。工作人员尝试查找的路径是本地虚拟机上的路径。有没有办法让我指定这个路径?或者他们必须到处都是一样的?
目前,我调整了我的目录以规避此错误。现在,在我有机会输入计数命令(Master removed our application: FAILED
)之前,我的Spark Shell失败。所有的工人都有同样的错误:
ERROR akka.remote.EndpointWriter: AssociationError [akka.tcp://[email protected]:7078] -> [akka.tcp://[email protected]:53633]:
Error [Association failed with [akka.tcp://[email protected]:53633]]
[akka.remote.EndpointAssociationException: Association failed with [akka.tcp://[email protected]:53633]
Caused by: akka.remote.transport.netty.NettyTransport$$anonfun$associate$1$$annon2: Connection refused: spark02/192.168.64.2:53633
由于怀疑,我遇到了网络问题。我现在应该看什么?
请问您可以尝试以下两件事情。 1.尝试从正在运行主节点的节点连接到主节点。 2.尝试用“IP地址”替换主机名。 – 2014-11-02 00:12:41
您可以从远程机器连接到Spark群集。 Spark shell只是集群上运行的另一个Scala程序。 – 2014-11-02 00:14:03
是的,这是可能的,应该工作。我怀疑网络问题。我不确定我的头顶,但我认为工作人员会尝试通过某个端口连接到本地计算机。从这些症状来看,我猜这是行不通的。也许你可以在工作日志中找到更多信息! – 2014-11-02 15:37:35