Knowledge Center Monthly Newsletter - March 2025
Stay up to date with the latest from the Knowledge Center. See all new and updated Knowledge Center articles published in the last month and re:Post’s top contributors.
为什么我在 Amazon EMR 中的 Yarn 应用程序仍处于 Accepted(已接受)状态?
我的 Amazon EMR 作业卡滞在 Accepted(已接受)状态,日志显示“WARN YarnScheduler: Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient resources.”(警告 YarnScheduler:初始作业未接受任何资源;请检查您的集群用户界面以确保 Worker 已注册并拥有足够的资源。)
简短描述
如果集群没有足够的资源来完成作业请求,EMR 作业将卡滞在 Accepted(已接受)状态。发生这种情况的原因可能如下:
- YARNMemoryAvailablePercentage 非常低,许多容器处于待处理状态。
- 由于核心节点上的资源不足,应用程序无法启动应用程序主容器。这可能发生在 Amazon EMR 5.19.0 及更高版本上,不包括 Amazon EMR 6.x 系列。
- 核心节点运行状况不佳。
- 一项 EMR 作业消耗了所有资源。
解决方法
集群没有足够的资源来完成作业请求
1.连接到资源管理器用户界面或使用任何节点上的以下命令来检查资源:
yarn top 10
2.检查 Used Resources(已用资源)是否几乎等于 Total Resources(总资源)。您还可以查看 Amazon CloudWatch 指标以了解 YARNMemoryAvailablePercentage 和 MemoryAvailableMB。
4.如果需要,请为集群增加更多容量。您可以使用 EMR 托管式自动扩缩功能或自动扩缩来根据资源利用率自动增加或缩减容量。
核心节点上的资源不足。
在 EMR 5.19.0 及更高版本上(6.0 系列除外),应用程序主容器默认在核心节点上运行。在 EMR 6.x 系列中,应用程序主容器可以在核心节点和任务节点上运行。
由于提交的作业数量增加以及核心节点减少,核心节点无法分配另一个应用程序主容器。因此,即使任务节点有足够的内存,作业也可能会卡住。如果发生这种情况,您可能会在容器日志中看到以下消息:
Application is Activated, waiting for resources to be assigned for AM. Last Node which was processed for the application : ip-xxxx:8041 ( Partition : [], Total resource : <memory:516096, vCores:64>, Available resource : <memory:516096,vCores:64> ). Details : AM Partition = CORE ; Partition Resource = <memory:516096, vCores:64> ; Queue's Absolute capacity = 100.0 % ; Queue's Absolute used capacity = 99.53497 % ; Queue's Absolute max capacity =100.0 %
如果发生这种情况,请终止作业以释放一些资源。或者,增加集群的核心节点数量。
此外,您可以在 Amazon EMR 5.x 中关闭 YARN 标签。
核心节点运行状况不佳
如果核心节点耗尽磁盘空间并且装载点的磁盘利用率超过 90%,Amazon EMR 会认为该节点运行状况不佳。新容器未安排在运行状况不佳的节点上。如果发生这种情况,主实例的控制器日志中会显示以下消息。日志位于 /emr/instance-controller/log。
Yarn unhealthy Reason : 1/4 local-dirs usable space is below configured utilization percentage/no more usable space [ /mnt/yarn : used space above threshold of 90.0% ] ; 1/1 log-dirs usable space is below configured utilization percentage/no more usable space [ /var/log/hadoop-yarn/containers : used space above threshold of 90.0% ]
要更正运行状况不佳的节点,请通过删除旧的容器日志或 spark 事件日志来减少磁盘使用率。您还可以根据磁盘利用率动态扩展存储。
有一项作业正在消耗所有资源,或者 Spark 参数的配置超出了集群限制
在 Amazon EMR 中,Spark 动态分配默认处于启用状态。如果 Spark 作业配置不正确,则该作业可能会消耗集群的所有资源。例如,如果 Max Executors (spark.dynamicAllocation.maxExecutors) 的限制不够高,就会出现此错误。对于 Spark 作业,请调整内存限制以避免一项作业消耗集群的所有资源。
如果执行程序内存或驱动程序内存大于 Yarn 配置的参数,则作业接受失败。Yarn 配置的参数是 yarn.scheduler.maximum-allocation-mb 和 yarn.nodemanager.resource.memory-mb。如果发生这种情况,您将看到与以下内容类似的错误消息:
22/01/03 20:05:05 INFO Client: Verifying our application has not requested more than the maximum memory capability of the cluster (24576 MB per container) Exception in thread "main" java.lang.IllegalArgumentException: Required executor memory (49152),overhead (6144 MB), and PySpark memory (0 MB) is above the max threshold (24576 MB) of this cluster! Please check the values of 'yarn.scheduler.maximum-allocation-mb' and/or 'yarn.nodemanager.resource.memory-mb'.
要解决此问题,请执行以下操作:
- 在更改内存值之前验证每个实例类型的 yarn 内存量。
- 实施 CapacityScheduler 队列以限制作业使用的作业资源。

相关内容
- AWS 官方已更新 7 个月前
- AWS 官方已更新 5 个月前
- AWS 官方已更新 2 年前
- AWS 官方已更新 3 年前