Springboot火花纱

Springboot spark yarn

我是 Spark 的新手,我正在尝试将我的 spring spark 应用程序提交到 yarn cluster。 spark 配置在 spring 中初始化,但在提交时没有获取 yarn 详细信息,它始终指向本地。我知道我错过了一些要设置的配置。

使用的代码如下:

SparkConf sparkconf = new SparkConf().setAppName("app name")
                    .set("spark.port.maxRetries", "100")
                    .set("spark.ui.port", "4060")
                    .set("spark.executor.memory", "7g")
                    .set("spark.executor.cores", "2")
                    .set("SPARK_YARN_MODE", "true")
                    .setSparkHome("spark home directory")
                    .set("SPARK_JAR_HDFS_PATH", "directory of spark-assembly.jar")
                    .set("SPARK_CONF_DIR", "config directory")
                    .setMaster("yarn-client"); 

在本地模式下尝试 运行 的地方记录如下, [o.a.h.y.c.RMProxy:56] 连接到位于 /0.0.0.0:8032 的 ResourceManager

Config used,
conf.addResource(new Path(filepath+ "/hbase-site.xml"));
            conf.addResource(new Path(filepath+ "/core-site.xml"));
            conf.addResource(new Path(filepath+ "/hdfs-site.xml"));
            conf.addResource(new Path(filepath+ "/yarn-site.xml"));

原因是资源路径中提到的配置文件没有正确获取,尤其是 yarn-site.xml 文件,所以清理并重建项目以解决问题。