自动设置 Dataproc 集群后 Yarn/Spark 的内存分配不正确

Incorrect memory allocation for Yarn/Spark after automatic setup of Dataproc Cluster

我正在尝试 运行 Dataproc 集群上的 Spark 作业,但由于 Yarn 配置错误,Spark 无法启动。

当 运行ning "spark-shell" 来自 shell(在本地主服务器上)时,以及通过 web-GUI 和来自我本地计算机的 gcloud 命令行实用程序:

15/11/08 21:27:16 ERROR org.apache.spark.SparkContext: Error initializing     SparkContext.
java.lang.IllegalArgumentException: Required executor memory (38281+2679 MB) is above the max threshold (20480 MB) of this cluster! Please increase the value of 'yarn.s
cheduler.maximum-allocation-mb'.

我尝试修改 /etc/hadoop/conf/yarn-site.xml 中的值,但没有任何改变。我认为它不会从该文件中提取配置。

我已经在多个站点(主要是欧洲)尝试了多个集群组合,但我只让它与低内存版本(4 核,15 GB 内存)一起使用。

即这只是配置内存高于 yarn 默认允许的节点上的问题。

对于您 运行 遇到的这些问题,我们深表歉意!看起来这是一个已知问题的一部分,即某些内存设置最终是根据主计算机的大小而不是工作计算机的大小计算的,我们希望很快在即将发布的版本中解决这个问题。

目前有两种解决方法:

  1. 使用内存等于或小于内存的主机类型 比工人机器类型。
  2. 如果 运行 来自 SSH 连接,则使用 --conf 标志显式设置 spark.executor.memory 和 spark.executor.cores,例如:

    spark-shell --conf spark.executor.memory=4g --conf spark.executor.cores=2
    

    或者如果 运行 gcloud beta dataproc,使用 --properties:

    gcloud beta dataproc jobs submit spark --properties spark.executor.memory=4g,spark.executor.cores=2
    

您可以根据需要调整每个执行者的数量cores/memory;偏向于较小的执行程序并让 YARN 将大量执行程序打包到每个工作程序上是可以的,尽管您可以通过将 spark.executor.memory 设置为每个 YARN 容器中可用的完整大小和 [=37 来节省一些每个执行程序的开销=]到每个工人的所有核心。

编辑:自 1 月 27 日起,现在可以为 master/worker 机器类型的任意组合正确配置新的 Dataproc 集群,如 release notes.

中所述