【发布时间】:2014-12-27 19:16:30
【问题描述】:
我有一个 Spark 集群设置,其中包含一个 master 和 3 个 worker。我还在 CentOS 虚拟机上安装了 Spark。我正在尝试从我的本地 VM 运行一个 Spark shell,它将连接到主服务器,并允许我执行简单的 Scala 代码。所以,这是我在本地 VM 上运行的命令:
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
很遗憾,该命令不起作用。 shell 只会无休止地打印相同的警告:
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 UI 上的主 URL 相同。我可以 ping 和 ssh 两种方式(集群到本地 VM,反之亦然)。此外,我玩过 executor-memory 参数(增加和减少内存)无济于事。最后,我尝试禁用双方的防火墙(iptables),但我一直收到同样的错误。我正在使用 Spark 1.0.2。
TL;DR 是否可以远程运行 Apache Spark shell(并固有地远程提交应用程序)?如果是这样,我错过了什么?
编辑:我查看了工人日志,发现工人找不到 Spark:
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
...
Spark 安装在我的本地 VM 上与集群上不同的目录中。工作人员试图找到的路径是我本地 VM 上的路径。有没有办法让我指定这条路径?还是它们必须在任何地方都相同?
目前,我调整了我的目录以规避此错误。现在,在我有机会输入 count 命令之前,我的 Spark Shell 失败了 (Master removed our application: FAILED)。所有工人都有相同的错误:
ERROR akka.remote.EndpointWriter: AssociationError [akka.tcp://sparkWorker@spark02:7078] -> [akka.tcp://sparkExecutor@spark02:53633]:
Error [Association failed with [akka.tcp://sparkExecutor@spark02:53633]]
[akka.remote.EndpointAssociationException: Association failed with [akka.tcp://sparkExecutor@spark02:53633]
Caused by: akka.remote.transport.netty.NettyTransport$$anonfun$associate$1$$annon2: Connection refused: spark02/192.168.64.2:53633
正如我所怀疑的,我遇到了网络问题。我现在应该看什么?
【问题讨论】:
-
请您尝试以下两件事。 1.尝试从运行master的节点连接到master。 2. 尝试用“无处不在”的 IP 替换主机名。
-
您可以从远程计算机连接到 Spark 集群。 Spark shell 只是另一个运行在集群上的 Scala 程序。
-
是的,这是可能的并且应该可以。我怀疑网络问题。我不确定我的想法,但我认为工作人员会尝试在某个端口上连接到您的本地计算机。从症状来看,我猜这行不通。也许您可以在工作人员日志中找到更多信息!
-
您还应该检查网络问题。我知道两种问题。首先 - 正向和反向查找的 DNS 问题应该适用于来自 master、driver 和 worker 的每个 ip 和主机名。第二个问题是驱动程序或主机上的几个 IP 地址。检查日志并找到主控和驱动程序选择的 IP 地址。可能选择的地址在工作人员网络中不可用。
-
如果我从其中一名工人或主人自己启动外壳,一切都会很好。我只从我的本地虚拟机遇到这个问题。我之前也尝试过在“任何地方”使用 IP。不幸的是,它什么也没做。我了解 Spark shell 是另一个 Scala 程序。我想做的是提交我自己的 Spark 应用程序。我在这里使用 Spark shell,因为我想将我的编程/代码排除在外,以隔离问题。
标签: apache-spark