為什麼我的 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%。
- 核心執行個體是 Spot 執行個體,而 Spot 執行個體是 TERMINATED_BY_SPOT_DUE_TO_NO_CAPACITY。
如需 Spot 執行個體終止的相關資訊,請參閱為什麼 Amazon EC2 終止了我的 Spot 執行個體
如需有關 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) 容量。如需詳細資訊,請參閱如何解決 Amazon EMR 中的 "Exit status: -100.Diagnostics: Container released on a *lost* node (退出狀態:-100。診斷:容器在 Amazon EMR 中的*遺失*節點上釋放)" 錯誤?
- 為 MRUnhealthyNodes Amazon CloudWatch 指標建立警示。您可以設定此警示的通知,在達到 45 分鐘逾時之前警告您節點運作狀況不良。如需詳細資訊,請參閱根據靜態閾值建立 CloudWatch 警示。
502 錯誤閘道
當 Amazon EMR 內部系統在一段時間內無法到達主節點時,就會發生 502 錯誤閘道錯誤。如果關閉終止保護,Amazon EMR 就會終止。當 instance-controller 服務關閉時,請檢查最新的 instance-controlle 日誌和執行個體狀態日誌。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 叢集主節點因任何原因停止時,叢集會以使用者終止主節點錯誤終止。
以下是來自 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 主節點或所有核心節點會導致叢集終止,因此請避免停止或重新啟動叢集節點。

相關內容
- 已提問 5 個月前lg...
- 已提問 5 個月前lg...
- 已提問 5 個月前lg...
- 已提問 4 個月前lg...
- 已提問 5 個月前lg...
- AWS 官方已更新 4 個月前
- AWS 官方已更新 3 個月前
- AWS 官方已更新 9 個月前
- AWS 官方已更新 2 個月前