【发布时间】:2017-10-12 19:25:22
【问题描述】:
我刚刚推出了一个 Hadoop/Spark 集群,以便在我的公司启动一项数据科学计划。我使用 Ambari 作为管理器并安装了 Hortonworks 发行版(HDFS 2.7.3、Hive 1.2.1、Spark 2.1.1,以及其他必需的服务。顺便说一下,我正在运行 RHEL 7。我有 2 个名称节点,10个数据节点,1个hive节点和1个管理节点(Ambari)。
我根据 Apache 和 Ambari 文档构建了一个防火墙端口列表,并让我的基础架构人员推动这些规则。我遇到了 Spark 想要选择随机端口的问题。当我尝试运行 Spark 作业(传统的 Pi 示例)时,它会失败,因为我没有打开整个临时端口范围。由于我们可能会运行多个作业,因此让 Spark 处理此问题并仅从短暂的端口范围 (1024 - 65535) 中进行选择而不是指定单个端口是有意义的。我知道我可以选择一个范围,但为了方便起见,我只是让我的人打开整个短暂范围。起初,我的基础设施人员对此犹豫不决,但当我告诉他们目的时,他们就照做了。
基于此,我认为我的问题已解决,但是当我尝试运行作业时,它仍然失败:
Log Type: stderr
Log Upload Time: Thu Oct 12 11:31:01 -0700 2017
Log Length: 14617
Showing 4096 bytes of 14617 total. Click here for the full log.
Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:28:52 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:28:53 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:28:54 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:28:55 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:28:56 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:28:57 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:28:57 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:28:59 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:29:00 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:29:01 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:29:02 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:29:03 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:29:04 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:29:05 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:29:06 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:29:06 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:29:07 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:29:09 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:29:10 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:29:11 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:29:12 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:29:13 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:29:14 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:29:15 ERROR ApplicationMaster: Failed to connect to driver at 10.10.98.191:33937, retrying ...
17/10/12 11:29:15 ERROR ApplicationMaster: Uncaught exception:
org.apache.spark.SparkException: Failed to connect to driver!
at org.apache.spark.deploy.yarn.ApplicationMaster.waitForSparkDriver(ApplicationMaster.scala:607)
at org.apache.spark.deploy.yarn.ApplicationMaster.runExecutorLauncher(ApplicationMaster.scala:461)
at org.apache.spark.deploy.yarn.ApplicationMaster.run(ApplicationMaster.scala:283)
at org.apache.spark.deploy.yarn.ApplicationMaster$$anonfun$main$1.apply$mcV$sp(ApplicationMaster.scala:783)
at org.apache.spark.deploy.SparkHadoopUtil$$anon$1.run(SparkHadoopUtil.scala:67)
at org.apache.spark.deploy.SparkHadoopUtil$$anon$1.run(SparkHadoopUtil.scala:66)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1866)
at org.apache.spark.deploy.SparkHadoopUtil.runAsSparkUser(SparkHadoopUtil.scala:66)
at org.apache.spark.deploy.yarn.ApplicationMaster$.main(ApplicationMaster.scala:781)
at org.apache.spark.deploy.yarn.ExecutorLauncher$.main(ApplicationMaster.scala:804)
at org.apache.spark.deploy.yarn.ExecutorLauncher.main(ApplicationMaster.scala)
17/10/12 11:29:15 INFO ApplicationMaster: Final app status: FAILED, exitCode: 10, (reason: Uncaught exception: org.apache.spark.SparkException: Failed to connect to driver!)
17/10/12 11:29:15 INFO ShutdownHookManager: Shutdown hook called
起初我想也许我对 Spark 和 namenodes/datanodes 有某种错误配置。然而,为了测试它,我只是在每个节点上停止了 firewalld 并再次尝试了这项工作,它工作得很好。
所以,我的问题 - 我打开了整个 1024 - 65535 端口范围 - 我可以看到 Spark 驱动程序正在尝试连接这些高端口(如上所示 - 30k - 40k 范围)。但是,由于某种原因,当防火墙打开时,它会失败,而当它关闭时,它会起作用。我检查了防火墙规则,果然,端口是打开的 - 这些规则正在工作,因为我可以访问在同一个 firewalld xml 规则文件中指定的 Ambair、Yarn 和 HFDS 的 Web 服务......
我是 Hadoop/Spark 的新手,所以我想知道我缺少什么吗?我需要考虑 1024 下的一些较低端口吗?以下是我打开的 1024 以下的端口列表,以及 1024 - 65535 端口范围:
88
111
443
1004
1006
1019
很可能我错过了一个我真正需要但不知道的较低编号的端口。除此之外,其他一切都应由 1024 - 65535 端口范围处理。
【问题讨论】:
-
您是否在所有方向上打开了所有端口——即驱动程序到执行器、执行器到驱动程序、执行器到执行器?
-
您可以强制 Spark 使用一个足够大的端口范围以用于实际目的,但仍然小于“一切”... cf。 stackoverflow.com/questions/27729010/…
-
@Samson Scharfrichter - 是的,所有节点上的所有端口都是开放的。即使我认为我不需要所有盒子上的完全相同的端口,我还是让它们在所有节点上打开了范围。只要firewalld在所有盒子上都打开了范围,那应该就是我所需要的,对吧?我认为您没有指定 in 或 out,对吗?
-
@Samson Scharfrichter - 是的,我知道我可以指定一个范围,事实上,这是我首先拥有的,但为了以防万一,我决定打开整个范围,这样我就可以排除故障。
-
所以,我的一位安全人员刚刚提到的是,即使我已经打开了端口,工作节点如何知道要监听的端口......他让我相信即使端口范围是打开的,当 spark 驱动程序尝试与作业联系时,它仍然需要侦听这些端口。这似乎是合乎逻辑的,尤其是当我关闭防火墙服务时,它可以工作。我在这里走错路了吗?
标签: apache-spark hadoop2 ambari