在 Yarn 集群上提交 Spark 作业

2024-03-31

我现在已经为以下问题苦苦挣扎了 2 天多。

我用 Scala 编写了一个基本的“HelloWorld”脚本:

object Hello extends App{
  println("WELCOME TO A FIRST TEST WITH SCALA COMPILED WITH SBT counting fr. 1:15 with sleep 1")
  val data = 1 to 15

  for( a <- data ){
    println( "Value of a: " + a )
    Thread sleep 1000
  }

然后我用 SBT 进行编译以获得 JAR 编译版本。

然后,我使用 HDP 2.2.4.2 将所有内容转移到集群(这是在虚拟 Linux 计算机上运行的 Horthonworks 沙箱)上。

实际上,我可以使用纱线客户端在集群上使用以下命令运行该作业:

spark-submit --verbose --master yarn-client --class Hello SCALA/hello.jar

但是,在尝试使用以下命令在纱线集群上提交相同的 helloWorld 作业时

spark-submit --verbose --master yarn-cluster--class Hello SCALA/hello.jar

该作业首先正常运行(输出是预期的,并且退出 0),但随后作业停止并显示以下内容:

15/06/05 15:52:09 INFO Client: Application report for application_1433491352951_0010 (state: FAILED)

15/06/05 15:52:09 INFO Client:
         client token: N/A
         diagnostics: Application application_1433491352951_0010 failed 2 times due to AM Container for appattempt_1433491352951_0010_000002 exited with  exitCode: 0
For more detailed output, check application tracking page:http://sandbox.hortonworks.com:8088/proxy/application_1433491352951_0010/Then, click on links to logs of each attempt.
Diagnostics: Failing this attempt. Failing the application.
         ApplicationMaster host: N/A
         ApplicationMaster RPC port: -1
         queue: default
         start time: 1433519471297
         final status: FAILED
         tracking URL: http://sandbox.hortonworks.com:8088/cluster/app/application_1433491352951_0010
         user: root
Error: application failed with exception
org.apache.spark.SparkException: Application finished with failed status
        at org.apache.spark.deploy.yarn.ClientBase$class.run(ClientBase.scala:522)
        at org.apache.spark.deploy.yarn.Client.run(Client.scala:35)
        at org.apache.spark.deploy.yarn.Client$.main(Client.scala:139)
        at org.apache.spark.deploy.yarn.Client.main(Client.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.spark.deploy.SparkSubmit$.launch(SparkSubmit.scala:367)
        at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:77)
        at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)

然后我决定使用以下命令行检查日志:

yarn logs -applicationId application_1433491352951_00010

我得到:

15/06/05 15:56:33 INFO impl.TimelineClientImpl: Timeline service address: http://sandbox.hortonworks.com:8188/ws/v1/timeline/
15/06/05 15:56:33 INFO client.RMProxy: Connecting to ResourceManager at sandbox.hortonworks.com/192.168.182.129:8050
15/06/05 15:56:35 INFO zlib.ZlibFactory: Successfully loaded & initialized native-zlib library
15/06/05 15:56:35 INFO compress.CodecPool: Got brand-new decompressor [.deflate]


Container: container_e08_1433491352951_0010_01_000001 on sandbox.hortonworks.com_45454
========================================================================================
LogType:stderr
Log Upload Time:Fri Jun 05 15:52:10 +0000 2015
LogLength:2050
Log Contents:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/hadoop/yarn/local/usercache/root/filecache/28/spark-assembly-1.2.1.2.2.4.2-2-hadoop2.6.0.2.2.4.2-2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/2.2.4.2-2/hadoop/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/hadoop/yarn/local/usercache/root/filecache/29/hello.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/06/05 15:51:18 INFO yarn.ApplicationMaster: Registered signal handlers for [TERM, HUP, INT]
15/06/05 15:51:20 INFO yarn.ApplicationMaster: ApplicationAttemptId: appattempt_1433491352951_0010_000001
15/06/05 15:51:21 INFO spark.SecurityManager: Changing view acls to: yarn,root
15/06/05 15:51:21 INFO spark.SecurityManager: Changing modify acls to: yarn,root
15/06/05 15:51:21 INFO spark.SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(yarn, root); users with modify permissions: Set(yarn, root)
15/06/05 15:51:21 INFO yarn.ApplicationMaster: Starting the user JAR in a separate Thread
15/06/05 15:51:21 INFO yarn.ApplicationMaster: Waiting for spark context initialization
15/06/05 15:51:21 INFO yarn.ApplicationMaster: Waiting for spark context initialization ... 0
15/06/05 15:51:31 INFO yarn.ApplicationMaster: Waiting for spark context initialization ... 1
15/06/05 15:51:36 INFO yarn.ApplicationMaster: Final app status: SUCCEEDED, exitCode: 0
15/06/05 15:51:41 ERROR yarn.ApplicationMaster: SparkContext did not initialize after waiting for 100000 ms. Please check earlier log output for errors. Failing the application.
15/06/05 15:51:41 INFO yarn.ApplicationMaster: Unregistering ApplicationMaster with SUCCEEDED
15/06/05 15:51:41 INFO yarn.ApplicationMaster: Deleting staging directory .sparkStaging/application_1433491352951_0010

LogType:stdout
Log Upload Time:Fri Jun 05 15:52:10 +0000 2015
LogLength:300
Log Contents:
WELCOME TO A FIRST TEST WITH SCALA COMPILED WITH SBT counting fr. 1:15 with sleep 1
Value of a: 1
Value of a: 2
Value of a: 3
Value of a: 4
Value of a: 5
Value of a: 6
Value of a: 7
Value of a: 8
Value of a: 9
Value of a: 10
Value of a: 11
Value of a: 12
Value of a: 13
Value of a: 14
Value of a: 15



Container: container_e08_1433491352951_0010_02_000001 on sandbox.hortonworks.com_45454
========================================================================================
LogType:stderr
Log Upload Time:Fri Jun 05 15:52:10 +0000 2015
LogLength:2050
Log Contents:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/hadoop/yarn/local/usercache/root/filecache/28/spark-assembly-1.2.1.2.2.4.2-2-hadoop2.6.0.2.2.4.2-2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/2.2.4.2-2/hadoop/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/hadoop/yarn/local/usercache/root/filecache/29/hello.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/06/05 15:51:45 INFO yarn.ApplicationMaster: Registered signal handlers for [TERM, HUP, INT]
15/06/05 15:51:47 INFO yarn.ApplicationMaster: ApplicationAttemptId: appattempt_1433491352951_0010_000002
15/06/05 15:51:48 INFO spark.SecurityManager: Changing view acls to: yarn,root
15/06/05 15:51:48 INFO spark.SecurityManager: Changing modify acls to: yarn,root
15/06/05 15:51:48 INFO spark.SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(yarn, root); users with modify permissions: Set(yarn, root)
15/06/05 15:51:48 INFO yarn.ApplicationMaster: Starting the user JAR in a separate Thread
15/06/05 15:51:48 INFO yarn.ApplicationMaster: Waiting for spark context initialization
15/06/05 15:51:48 INFO yarn.ApplicationMaster: Waiting for spark context initialization ... 0
15/06/05 15:51:58 INFO yarn.ApplicationMaster: Waiting for spark context initialization ... 1
15/06/05 15:52:03 INFO yarn.ApplicationMaster: Final app status: SUCCEEDED, exitCode: 0
15/06/05 15:52:08 ERROR yarn.ApplicationMaster: SparkContext did not initialize after waiting for 100000 ms. Please check earlier log output for errors. Failing the application.
15/06/05 15:52:08 INFO yarn.ApplicationMaster: Unregistering ApplicationMaster with SUCCEEDED
15/06/05 15:52:08 INFO yarn.ApplicationMaster: Deleting staging directory .sparkStaging/application_1433491352951_0010

LogType:stdout
Log Upload Time:Fri Jun 05 15:52:10 +0000 2015
LogLength:300
Log Contents:
WELCOME TO A FIRST TEST WITH SCALA COMPILED WITH SBT counting fr. 1:15 with sleep 1
Value of a: 1
Value of a: 2
Value of a: 3
Value of a: 4
Value of a: 5
Value of a: 6
Value of a: 7
Value of a: 8
Value of a: 9
Value of a: 10
Value of a: 11
Value of a: 12
Value of a: 13
Value of a: 14
Value of a: 15

我拿了你好世界有人建议、重新编译并再次尝试的项目。现在我遇到了另一个问题:当我使用以下命令提交任务时:

spark-submit --verbose --master yarn-cluster SCALA/hello.jar

我收到以下评论:

15/06/08 16:42:35 INFO Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 9 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)

我不太明白,因为看起来服务器没有响应,而程序应该从沙箱在 Hadoop 集群上运行。


就我而言,我使用了:

val config = new SparkConf()
config.setMaster("local[*]") 

并使用以下方式提交作业:

spark-submit --master yarn-cluster ..

一旦我删除了config.setMaster从我的代码来看,问题已经解决。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 Yarn 集群上提交 Spark 作业 的相关文章

随机推荐

  • Xcode 4.2:如何从子项目导入 .h 文件

    我是 Xcode 子项目的新手 在我的 iPhone 应用程序项目中MyProject 我正在尝试将一些常见代码重构为一个名为的静态库项目MyLibrary 我创建后MyLibrary并移动代码 MyProject不再编译 错误在于MyPr
  • 在 openCV 中连接足够近的轮廓

    我有一组从图像中检测到的轮廓 斑点 问题在于 一些斑点在斑点检测和平滑过程中被分割 我尝试使用以下代码 Mat outlines Mat zeros m3 size CV 8UC3 findContours m3 contours CV R
  • 多匹配布尔提升

    我正在尝试执行以下操作 curl X POST localhost 9200 magento customer search pretty 1 d query bool must multi match query john fields
  • cygwin git下的KDiff3不会调用

    为了与互联网上发布的许多解决方案保持一致 我安装了 KDiff3 并进行了修改 gitconfig如下所示来使用它 尽管如此 当我跑步时git diff HEAD HEAD在存储库中进行测试 我得到了默认工具执行的差异 我在 Windows
  • NestJS 在非模块文件中注入模块服务

    我有一个用于视图渲染的函数文件 我想在这里使用 Nestjs 模块服务 我的渲染文件是这样的 export default parse render 因此 为了在这里使用模块服务 我尝试像这样注入 import Inject from ne
  • Django URL 模板匹配(除了模式之外的所有内容)

    我需要一个 django 正则表达式 它实际上适用于 url 路由器来执行以下操作 匹配路由中不包含 api 的所有内容 以下不起作用 因为 django 无法反转 r api 通常的方法是对路由声明进行排序 以便包罗万象的路由被 api路
  • 下载文件时强制显示“另存为”对话框

    下面的代码将文件保存到用户的磁盘上 function handleSaveImg event const image canvas toDataURL const saveImg document createElement a saveI
  • C# 中的内部与公共

    我想知道两者之间的区别public and internal可见性修饰符 我们什么时候应该使用internal在课堂上以及何时public 我对什么时候应该使用方法感到困惑public or internal 我读到了internal可以通
  • 将 SceneKit 对象放置在 SCNCamera 当前方向的前面

    我想在用户点击屏幕时创建一个新的 SceneKit 节点 并让它以设定的距离直接出现在相机前面 为了测试 这将是一个 SCNText 读取 您点击此处 它还应该与视线成直角 即 面向 相机 所以 鉴于self camera orientat
  • 循环遍历所有Mongo集合并执行查询

    首先 我对 mongodb 还很陌生 这是我的问题 我一直无法找到解决方案 假设我有 3 个不同的集合 mongos gt show collections collectionA collectionB collectionC 我想创建一
  • 是否可以在 C# 程序中使用 C++ .lib 文件?

    是否可以在 C 程序中使用 C lib 文件 有很多方法 阅读 MSDN 中有关 互操作 的内容 一种方法是将 lib 作为 DLL 公开 然后使用 pinvoke 从 C 项目调用这些函数 不过 这限制了您只能使用 C 风格的界面 如果您
  • 为什么 float 类型会将 0.5 舍入为 0?如何避免? [复制]

    这个问题在这里已经有答案了 我有这样的声明 SQL Server 2012 SELECT ROUND CAST 50 9685 as float 3 AS Col1 INTO Test 我想看到结果 50 969 但事实上我看到 50 96
  • 如何在 Android Studio 1.3 中设置 Gradle JVM 设置

    从版本 1 3 开始 Android Studio 将不再支持 IDE 特定的 Gradle JVM 参数设置 Gradle JVM 设置需要在 gradle properties 文件中设置 无论构建在何处 IDE 命令行或 CI 服务器
  • 在WPF中使用多重绑定时是否必须使用转换器?

    我想知道是否存在无需转换器即可使用多重绑定的场景 以及迫使我们使用转换器的限制 特别是 我试图以 string format 样式将一个字符串绑定到另外两个字符串 您最常使用的区域MultiBinding没有转换器是指您有一个字符串格式连接
  • libssh 支持 sftp 服务器功能吗?

    在我的项目中 我需要在服务器和多个客户端之间传输文件 客户端和服务器之间的通信应该加密 应该通过用户名和密码进行身份验证 而且协议应该是通用的 所以就想到了sftp ssh 有两个 c c 库 libssh 和 libssh2 其中只有第一
  • 查看 iframe url 是否已更改

    有没有办法让我知道 iframe 中的 URL 是否已更改 即用户已导航到某个地方 谢谢 类似的问题在这里 https stackoverflow com questions 44359 how do i get the current l
  • Jenkins下的Maven toolchains.xml位置

    我发现很难将 Maven 工具链与 Jenkins 一起使用 我需要指定测试应该使用 32 位 JVM 运行 并通过在中放置合适的 JDK 定义来执行此操作 HOME m2 toolchains xml当我在机器上本地运行时可以工作 但是如
  • 模拟没有可用磁盘空间情况的最简单方法?

    我需要在没有剩余磁盘空间的情况下测试我的网络应用程序 即我无法写入更多文件 但我不想只是为了确保确实没有剩余空间而在硬盘中塞满垃圾 我想要的是用特定的进程 实际上是一个 PHP 应用程序 来模拟这种情况 事实上 暂时禁止进程的磁盘写入就足够
  • Python 中多个 websocket 客户端连接的最佳方法?

    我很高兴我要问的问题相当广泛 但是 作为 Python 的新手 我正在努力寻找 最佳 方法来做一些事情 这在 Node js 中是微不足道的 而在 Node js 中则非常微不足道 其他环境 例如 C 假设有一个装满东西的仓库 假设该仓库有
  • 在 Yarn 集群上提交 Spark 作业

    我现在已经为以下问题苦苦挣扎了 2 天多 我用 Scala 编写了一个基本的 HelloWorld 脚本 object Hello extends App println WELCOME TO A FIRST TEST WITH SCALA