欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

spark2.2.1中spark.yarn.jars|spark.yarn.archive的正确配置

程序员文章站 2022-06-18 16:16:54
【ERROR】 错误: 找不到或无法加载主类 org.apache.spark.deploy.yarn.ExecutorLauncher End Could not find or load...

【ERROR】 错误: 找不到或无法加载主类 org.apache.spark.deploy.yarn.ExecutorLauncher End
Could not find or load main class org.apache.spark.deploy.yarn.ExecutorLauncher
Application failed 2 times due to AM Container: exited with exitCode: 1

【ERROR】 spark.SparkContext: Error initializing SparkContext.

解决方案:
1. 创建 archive: jar cv0f spark-libs.jar -C $SPARK_HOME/jars/ .
2. 上传jar包到 HDFS: hdfs dfs -put spark-libs.jar /some/path/
3. 在spark-default.conf中设置 spark.yarn.archive=hdfs:///some/path/spark-libs.jar
或者 spark.yarn.jars=hdfs:///some/path/*.jar

另外对于自己配置的yarn集群(内存空间有限的情况下),尽量减小内存设定,在spark-default.conf中设置:

spark.yarn.am.memory=512M
spark.driver.memory=512M
spark.executor.memory=512M