gpt4 book ai didi

apache-spark - 如何远程运行Apache Spark Shell?

转载 作者:行者123 更新时间:2023-12-03 12:19:44 25 4
gpt4 key购买 nike

我有一个Spark集群安装程序,其中有一个主机和3个 worker 。我还在CentOS VM上安装了Spark。我正在尝试从我的本地VM运行一个Spark shell,它将连接到主服务器,并允许我执行简单的Scala代码。因此,这是我在本地VM上运行的命令:

bin/spark-shell --master spark://spark01:7077

shell 运行到可以输入Scala代码的地步。它说已授予执行者(x3-每个 worker 一个)。如果我看一下Master的UI,可以看到一个正在运行的应用程序Spark Shell。所有工作人员都处于 Activity 状态,使用了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上与群集上不同的目录中。 worker 尝试查找的路径是我的本地VM上的路径。有没有办法指定此路径?还是在每个地方都一样?

目前,我调整了目录以避免该错误。现在,我的Spark Shell失败了,然后才有机会输入count命令( Master removed our application: FAILED)。所有 worker 都有相同的错误:
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

令人怀疑,我遇到了网络问题。我现在应该看什么?

最佳答案

我在spark客户端和spark集群上解决了这个问题。

检查您的网络,客户端A可以ping通彼此!然后在客户端A的spark-env.sh中添加两行配置。

首先

export SPARK_MASTER_IP=172.100.102.156  
export SPARK_JAR=/usr/spark-1.1.0-bin-hadoop2.4/lib/spark-assembly-1.1.0-hadoop2.4.0.jar

第二

使用集群模式测试您的Spark Shell!

关于apache-spark - 如何远程运行Apache Spark Shell?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26675173/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com