Spark:多个Spark-并行提交 [英] Spark : multiple spark-submit in parallel

查看:15
本文介绍了Spark:多个Spark-并行提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于阿帕奇Spark的一般性问题:

我们有一些消费Kafka消息的火花流脚本。 问题:它们随机失败,没有出现特定错误...

当我手动运行某些脚本时,它们在工作时什么也不做,其中一个脚本失败,并显示以下消息:

错误SparkUI:绑定SparkUI失败 Java.net.BindException:地址已在使用中:服务‘SparkUI’在16次重试后失败!

所以我想知道是否有一种特定的方法可以并行运行这些脚本?

它们都在同一个JAR中,我与Supervisor一起运行它们。 Spark安装在Yarn上的Cloudera Manager 5.4上。

以下是我启动脚本的方式:

sudo -u spark spark-submit --class org.soprism.kafka.connector.reader.TwitterPostsMessageWriter /home/soprism/sparkmigration/data-migration-assembly-1.0.jar --master yarn-cluster --deploy-mode client

谢谢您的帮助!

更新:我更改了命令,现在运行此命令(它现在停止并显示特定消息):

root@ns6512097:~# sudo -u spark spark-submit --class org.soprism.kafka.connector.reader.TwitterPostsMessageWriter --master yarn --deploy-mode client /home/soprism/sparkmigration/data-migration-assembly-1.0.jar
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/jars/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/jars/avro-tools-1.7.6-cdh5.4.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
15/09/28 16:14:21 INFO Remoting: Starting remoting
15/09/28 16:14:21 INFO Remoting: Remoting started; listening on addresses :[akka.tcp://sparkDriver@ns6512097.ip-37-187-69.eu:52748]
15/09/28 16:14:21 INFO Remoting: Remoting now listens on addresses: [akka.tcp://sparkDriver@ns6512097.ip-37-187-69.eu:52748]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/jars/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/jars/avro-tools-1.7.6-cdh5.4.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]

推荐答案

如果多个用户尝试同时启动Spark会话,或者现有Spark会话未关闭属性,则会出现此问题

有两种方法可以解决此问题。

  • 在另一个端口上启动新的Spark会话,如下所示

    spark-submit --conf spark.ui.port=5051 <other arguments>`<br>`spark-shell --conf spark.ui.port=5051
    
  • 使用4041到4056之间的端口查找所有Spark会话并使用KILL命令终止进程,可以使用netstat和KILL命令分别查找占用端口的进程和终止该进程。用法如下:

    sudo netstat -tunalp | grep LISTEN| grep 4041
    

上述命令将产生如下输出,最后一列是进程ID,在本例中,ID为32028

tcp        0      0 :::4040    :::*         LISTEN      32028/java

一旦找到进程id(Id),就可以使用以下命令终止spark进程(spark-shell或spark-mit)

sudo kill -9 32028

这篇关于Spark:多个Spark-并行提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆