为什么我的 EMR 集群被终止了?
我的 Amazon EMR 集群意外终止了。
解决方法
查看存储在 Amazon S3 中的 Amazon EMR 预调配日志
Amazon EMR 集群日志存储在集群启动时指定的 Amazon Simple Storage Service(Amazon S3)存储桶中。日志存储位置:s3://example-log-location/example-cluster-ID/node/example-EC2-instance-ID/。
**注意:**将 example-log-location、example-cluster-ID 和 example-EC2-instance-ID 替换为系统的命名。
以下是常见错误的列表:
SHUTDOWN_STEP_FAILED (USER_ERROR)
NO_SLAVES_LEFT (SYSTEM_ERROR)
The master failed: Error occurred: <html>??<head><title>502 Bad Gateway</title></head>??<body>??<center><h1>502 Bad Gateway</h1></center>??<hr><center>nginx/1.16.1</center>??</body>??</html>??
KMS_ISSUE (USER_ERROR)Terminated with errors, The master node was terminated by user.
**注意:**以上是最常见的终止错误。EMR 集群可能由于上述错误之外的错误而终止。有关更多信息,请参阅资源错误。
SHUTDOWN_STEP_FAILED (USER_ERROR)
在 EMR 集群中提交步骤作业时,可以在 ActionOnFailure 参数中指定步骤失败行为。如果为 ActionOnFailure 参数选择了 TERMINATE_CLUSTER 或 TERMINATE_JOB_FLOW,则 EMR 集群会终止。有关更多信息,请参阅 StepConfig。
以下是来自 AWS CloudTrail 的示例错误消息:
{ "severity": "ERROR", "actionOnFailure": "TERMINATE_JOB_FLOW", "stepId": "s-2I0GXXXXXXXX", "name": "Example Step", "clusterId": "j-2YJXXXXXXX", "state": "FAILED", "message": "Step s-2I0GXXXXXXXX (Example Step) in Amazon EMR cluster j-2YJXXXXXXX failed at 202X-1X-0X 0X:XX UTC." }
为避免出现此错误,请在提交步骤作业时使用 ActionOnFailure 参数中的 CONTINUE 或 CANCEL_AND_WAIT 选项。
NO_SLAVES_LEFT (SYSTEM_ERROR)
在以下情况下会出现此错误:
- EMR 集群中的终止保护已关闭。
- 所有核心节点都超过了 yarn-site 配置分类中最大利用率阈值指定的磁盘存储容量。默认的最大利用率阈值为 90%。
- 核心实例是竞价型实例,竞价型实例是 TERMINATED_BY_SPOT_DUE_TO_NO_CAPACITY。
有关终止竞价型实例的信息,请参阅 Amazon EC2 为何终止我的竞价型实例?
有关 NO_SLAVE_LEFT 错误的更多信息,请参阅集群终止,显示 NO_SLAVE_LEFT 且核心节点 FAILED_BY_MASTER。
以下是来自 instance-controller 的错误消息示例:
202X-0X-0X 1X:5X:5X,968 INFO Poller: InstanceJointStatusMap contains X entries (DD:5 R:3): i-0e336xxxxxxxxxxxx 25d21h R 25d21h ig-22 ip-1x-2xx-xx-1xx.local.xxx.com I: 52s Y:U 98s c: 0 am: 0 H:R 1.1%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% ]
要解决此错误:
- 将集群的终止保护保持为 ON(开启)状态。有关更多信息,请参阅终止保护和不健康的 YARN 节点。
- 使用 Amazon EMR 扩展策略(自动扩展和托管扩展),根据自身需求扩展核心节点。有关更多信息,请参阅扩展集群资源。
- 为集群添加更多 Amazon Elastic Block Storage (Amazon EBS) 能力。有关更多信息,请参阅如何解决“Exit status: -100.Diagnostics: Container released on a *lost* node”(退出状态:-100。诊断:已在“丢失”节点上发布容器)错误?
- 为 MRUnhealthyNodes Amazon CloudWatch 指标创建一个告警。您可以为此告警设置通知,在达到 45 分钟超时之前警告您节点运行状况不佳。有关更多信息,请参阅基于静态阈值创建 CloudWatch 告警。
502 无效网关
当 Amazon EMR 内部系统在一段时间内无法到达主节点时,就会发生 502 无效网关错误。如果终止保护已关闭,Amazon EMR 将终止。当 instance-controller 服务关闭时,查看最新的实例控制器日志和实例状态日志。instance-controller 标准输出显示服务因内存不足而终止。这表明集群的主节点内存不足。
以下是实例状态日志中的示例错误消息:
# dump instance controller stdout tail -n 100 /emr/instance-controller/log/instance-controller.out OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00007fb46c7c8000, 12288, 0) failed; error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 12288 bytes for committing reserved memory. # An error report file with more information is saved as: # /tmp/hs_err_pid16110.log # whats memory usage look like free -m total used free shared buff/cache available Mem: 15661 15346 147 0 167 69 Swap: 0 0 0
为避免发生上述错误,请启动具有更高实例类型的 EMR 集群,以利用更多内存来满足集群的需求。此外,清理磁盘空间,避免长时间运行的集群中出现内存中断。有关更多信息,请参阅如何排查 Amazon EMR 中出现“502 Bad Gateway”(502 无效网关)或“504 Gateway Time-out”(504 网关超时)错误的主节点故障?
KMS_ISSUE (USER_ERROR)
使用 Amazon EMR 安全配置加密 Amazon EBS 根设备和存储卷时,该角色必须具有适当的权限。如果缺少必要权限,则会收到 KMS_ISSUE 错误。
以下是来自 AWS CloudTrail 的示例错误消息:
The EMR Service Role must have the kms:GenerateDataKey* and kms:ReEncrypt* permission for the KMS key configuration when you enabled EBS encryption by default. You can retrieve that KMS key's ID by using the ec2:GetEbsDefaultKmsKeyId API.
为避免发生上述错误,请确保用于加密 Amazon EBS 根设备和存储卷的安全配置具有必要的权限。对于这些配置,请确保 Amazon EMR 服务角色 (EMR_DefaultRole_V2) 有权限使用指定的 AWS Key Management Service (AWS KMS) 密钥。
因错误而终止,主节点已被用户终止
当 EMR 集群主节点因任何原因停止时,集群将终止,并显示 The master node was terminated by user(主节点因用户错误而终止)。
以下是来自 AWS CloudTrail 的示例错误消息:
eventTime": "2023-01-18T08:07:02Z", "eventSource": "ec2.amazonaws.com", "eventName": "StopInstances", "awsRegion": "us-east-1", "sourceIPAddress": "52.xx.xx.xx", "userAgent": "AWS Internal", "requestParameters": { "instancesSet": { "items": [ { "instanceId": "i-xxf6c5xxxxxxxxxxx" } ] }, "force": false },
由于停止 EMR 主节点或所有核心节点会导致集群终止,因此请避免停止或重启集群节点。

相关内容
- 已提问 19 天前lg...
- 已提问 7 天前lg...
- 已提问 7 个月前lg...
- 已提问 1 个月前lg...
- AWS 官方已更新 2 年前
- AWS 官方已更新 5 个月前
- AWS 官方已更新 9 个月前
- AWS 官方已更新 4 个月前