在YARN集群模式下使用/ etc / hosts文件进行绑定

时间:2015-11-08 06:33:22

标签: hadoop apache-spark yarn hortonworks-data-platform

在具有两个inets的计算机上设置一个spark群集,一个公共另一个私有。集群中的/ etc / hosts文件具有集群中所有其他计算机的内部ip,如此。

  

internal_ip FQDN

但是当我在YARN客户端模式(pyspark --master yarn --deploy-mode client)中通过pyspark请求SparkContext时,akka会绑定到公共IP,从而导致超时。

15/11/07 23:29:23 INFO Remoting: Starting remoting
15/11/07 23:29:23 INFO Remoting: Remoting started; listening on addresses :[akka.tcp://sparkYarnAM@public_ip:44015]
15/11/07 23:29:23 INFO util.Utils: Successfully started service 'sparkYarnAM' on port 44015.
15/11/07 23:29:23 INFO yarn.ApplicationMaster: Waiting for Spark driver to be reachable.
15/11/07 23:31:30 ERROR yarn.ApplicationMaster: Failed to connect to driver at yarn_driver_public_ip:48875, retrying ...
15/11/07 23:31:30 ERROR yarn.ApplicationMaster: Uncaught exception: 
org.apache.spark.SparkException: Failed to connect to driver!
    at org.apache.spark.deploy.yarn.ApplicationMaster.waitForSparkDriver(ApplicationMaster.scala:427)
    at org.apache.spark.deploy.yarn.ApplicationMaster.runExecutorLauncher(ApplicationMaster.scala:293)
    at org.apache.spark.deploy.yarn.ApplicationMaster.run(ApplicationMaster.scala:149)
    at org.apache.spark.deploy.yarn.ApplicationMaster$$anonfun$main$1.apply$mcV$sp(ApplicationMaster.scala:574)
    at org.apache.spark.deploy.SparkHadoopUtil$$anon$1.run(SparkHadoopUtil.scala:66)
    at org.apache.spark.deploy.SparkHadoopUtil$$anon$1.run(SparkHadoopUtil.scala:65)
    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:1657)
    at org.apache.spark.deploy.SparkHadoopUtil.runAsSparkUser(SparkHadoopUtil.scala:65)
    at org.apache.spark.deploy.yarn.ApplicationMaster$.main(ApplicationMaster.scala:572)
    at org.apache.spark.deploy.yarn.ExecutorLauncher$.main(ApplicationMaster.scala:599)
    at org.apache.spark.deploy.yarn.ExecutorLauncher.main(ApplicationMaster.scala)
15/11/07 23:31:30 INFO yarn.ApplicationMaster: Final app status: FAILED, exitCode: 10, (reason: Uncaught exception: org.apache.spark.SparkException: Failed to connect to driver!)
15/11/07 23:31:30 INFO yarn.ApplicationMaster: Unregistering ApplicationMaster with FAILED (diag message: Uncaught exception: org.apache.spark.SparkException: Failed to connect to driver!)
15/11/07 23:31:30 INFO yarn.ApplicationMaster: Deleting staging directory .sparkStaging/application_1446960366742_0002

从日志中可以看出,私有IP被完全忽略,如何让YARN和spark使用hosts文件中指定的私有IP地址?

使用Ambari(HDP 2.4)

配置群集

2 个答案:

答案 0 :(得分:1)

+1问题。

Spark使用Akka进行通信。

所以这更像是一个Akka问题,而不是Spark。

  

如果您需要将网络接口绑定到其他地址 -   使用akka.remote.netty.tcp.bind-hostname和   akka.remote.netty.tcp.bind-port settings。

http://doc.akka.io/docs/akka/snapshot/additional/faq.html#Why_are_replies_not_received_from_a_remote_actor_

答案 1 :(得分:0)

目前这是spark中的一个问题,获得引发绑定到正确接口的火花的唯一方法是使用自定义名称服务器。

Spark基本上执行主机名查找,并使用它找到的IP地址与Akka绑定。解决方法是创建自定义绑定区域并运行名称服务器。

https://issues.apache.org/jira/browse/SPARK-5113