我使用 Eclipse 在 Java 中开发了一个 Spark 应用程序。
到目前为止,我通过将 master 的地址配置为“local[*]”来使用独立模式。
现在我想把这个应用程序部署到 Yarn 集群上。
我找到的唯一官方文档是 http://spark.apache.org/docs/latest/running-on-yarn.html
与在 mesos 集群上或独立部署的文档 (http://spark.apache.org/docs/latest/running-on-mesos.html) 不同,在 SparkContext 中没有任何 URL 可用于 master 的地址。
显然,我必须使用行命令在 Yarn 上部署 spark。
你知道有没有办法像standalone和mesos模式一样在SparkContext中配置master的地址?
最佳答案
实际上有一个 URL。
Ensure that
HADOOP_CONF_DIR
orYARN_CONF_DIR
points to the directory which contains the (client side) configuration files for the Hadoop cluster. These configs are used to write to HDFS and connect to the YARN ResourceManager
您应该至少有 hdfs-site.xml
、yarn-site.xml
和 core-site.xml
文件来指定您连接到的 Hadoop 集群的所有设置和 URL。
yarn-site.xml
中的一些属性包括 yarn.nodemanager.hostname
和 yarn.nodemanager.address
。
由于地址默认为 ${yarn.nodemanager.hostname}:0
,您可能只需要设置主机名。
关于hadoop - 如何从 SparkContext 连接 Apache Spark 和 Yarn?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41021594/