如何从 SparkContext 连接 Apache Spark 和 Yarn?
How to connect Apache Spark with Yarn from the SparkContext?
我在 Java 中使用 Eclipse 开发了一个 Spark 应用程序。
到目前为止,我通过将主地址配置为 '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
or YARN_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
,您可能只需要设置主机名。
我在 Java 中使用 Eclipse 开发了一个 Spark 应用程序。
到目前为止,我通过将主地址配置为 '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
,您可能只需要设置主机名。