美文网首页
Spark提交job报错:ERROR spark.SparkCo

Spark提交job报错:ERROR spark.SparkCo

作者: alexlee666 | 来源:发表于2019-10-17 21:40 被阅读0次

有时候在dev环境尤其是虚拟机集群的环境中,在启动spark job时有可能会遇到如下类似报错:

ERROR spark.SparkContext: Error initializing SparkContext.
java.lang.IllegalArgumentException: Required executor memory (1024+384 MB) is
above the max threshold (1024 MB) of this cluster! Please check the values of
'yarn.scheduler.maximum-allocation-mb' and/or 'yarn.nodemanager.resource.memory-mb'.
at org.apache.spark.deploy.yarn.Client.verifyClusterResources(Client.scala:319)

一、原因分析

从日志中很容易看出,Spark在初始化SparkContext的时候由于executor要求的内存超过了整个集群锁给出的内存的最大阈值了


二、解决方案

既然是所分配的硬件资源和所需求的硬件资源的冲突,解决办法分为两类:

    1. 减小required memory;
    1. 增加memory allocation;

前者可以通过在提交Spark job时,指定更小的executor memory来实现,比如:

--executor-memory=300M

后者则需要修改配置项的取值了,'yarn.scheduler.maximum-allocation-mb'被定义在了yarn-site.xml文件中:

<property>
  <name>yarn.scheduler.maximum-allocation-mb</name>
  <value>10000</value>
</property>

将该配置项的取值设置得大于required memory即可。


如有错误之处,敬请指正!

参考:https://www.cnblogs.com/yinchengzhe/p/5142659.html

相关文章

网友评论

      本文标题:Spark提交job报错:ERROR spark.SparkCo

      本文链接:https://www.haomeiwen.com/subject/azfbmctx.html