本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
AWSSupport-TroubleshootOpenSearchRedYellowCluster
描述
AWSSupport-TroubleshootOpenSearchRedYellowCluster
automation runbook 用于识别红色或黄色集群运行状况的原因,并指导您将集群更改回绿色。
如何工作?
该运行手册AWSSupport-TroubleshootOpenSearchRedYellowCluster
可帮助您排除红色或黄色群集的原因,并通过分析群集配置和资源利用率提供了解决此问题的后续步骤。
运行手册执行以下步骤:
-
对目标域调用 DescribeDomainAPI 以获取集群配置。
-
检查 OpenSearch 服务域是基于互联网(公共)还是基于亚马逊虚拟私有云 (VPC) 的。
-
根据集群配置创建公共 AWS Lambda 函数或基于 Amazon VPC 的函数。注意:Lambda 函数包含 APIs 对集群运行 OpenSearch 服务以确定集群为何处于红色或黄色状态的疑难解答代码。
-
删除 Lambda 函数。
-
显示已执行的检查以及解决红色或黄色群集问题的后续建议步骤。
文档类型
自动化
所有者
Amazon
平台
Linux,macOS, Windows
参数
所需的 IAM 权限
AutomationAssumeRole
参数需要执行以下操作才能成功使用运行手册。
-
cloudformation:CreateStack
-
cloudformation:DescribeStacks
-
cloudformation:DescribeStackEvents
-
cloudformation:DeleteStack
-
lambda:CreateFunction
-
lambda:DeleteFunction
-
lambda:InvokeFunction
-
lambda:GetFunction
-
es:DescribeDomain
-
es:DescribeDomainConfig
-
ec2:DescribeSecurityGroups
-
ec2:DescribeSubnets
-
ec2:DescribeVpcs
-
ec2:DescribeNetworkInterfaces
-
ec2:CreateNetworkInterface
-
ec2:DeleteNetworkInterface
-
ec2:DescribeInstances
-
ec2:AttachNetworkInterface
-
cloudwatch:GetMetricData
-
iam:PassRole
该LambdaExecutionRole
参数需要以下操作才能成功使用运行手册:
-
es:ESHttpGet
-
ec2:CreateNetworkInterface
-
ec2:DescribeNetworkInterfaces
-
ec2:DeleteNetworkInterface
LambdaExecutionRole
政策概述:
以下是 Lambda 函数的执行角色(AWS Identity and Access Management (IAM) 角色)的示例,该角色向该函数授予访问本运行手册所需的 AWS 服务和资源的权限。有关更多信息,请参阅 Lambda 执行角色。
注意
只有当ec2:DescribeNetworkInterfaces
您的 OpenSearch 服务集群基于 Amazon VPC 时,才需要ec2:CreateNetworkInterface
、和ec2:DeleteNetworkInterface
,以允许 Lambda 函数创建和管理 Amazon VPC 网络接口。有关更多信息,请参阅将出站联网连接到 Amazon VPC 和 Lambda 执行角色中的资源。
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "es:ESHttpGet", "Resource": [ "arn:<partition>:es:<region>:<account-id>:domain/<domain-name>/", "arn:<partition>:es:<region>:<account-id>:domain/<domain-name>/_cluster/health", "arn:<partition>:es:<region>:<account-id>:domain/<domain-name>/_cat/indices", "arn:<partition>:es:<region>:<account-id>:domain/<domain-name>/_cat/allocation", "arn:<partition>:es:<region>:<account-id>:domain/<domain-name>/_cluster/allocation/explain" ] }, { "Condition": { "ArnLikeIfExists": { "ec2:Vpc": "arn:<partition>:ec2:<region>:<account-id>:vpc/<vpc_id>" } }, "Action": [ "ec2:DeleteNetworkInterface", "ec2:CreateNetworkInterface", "ec2:DescribeNetworkInterfaces", "ec2:UnassignPrivateIpAddresses", "ec2:AssignPrivateIpAddresses" ], "Resource": "*", "Effect": "Allow" } ] }
说明
按照这些步骤对自动化进行配置:
-
导航到 AWS Systems Manager 控制台AWSSupport-TroubleshootOpenSearchRedYellowCluster
中的。 -
选择 Execute automation(执行自动化)。
-
要输入参数,请输入以下内容:
-
AutomationAssumeRole (可选):
允许 Systems Manager Automation 代表您执行操作的 AWS Identity and Access Management (IAM) 角色的亚马逊资源名称 (ARN)。如果未指定角色,Systems Manager Automation 将使用启动此运行手册的用户的权限。
-
LambdaExecutionRole (必填):
Lambda 将用于签署对您的亚马逊服务集群的请求的 IAM 角色的 ARN。 OpenSearch
-
DomainName (必填):
群集运行状况为红色或黄色的 OpenSearch 服务域的名称。
-
UtilizationThreshold (可选):
用于比较 CPUUtilization和 JVMMemory压力指标的利用率阈值百分比。默认值为 80。
-
-
如果您已在 S OpenSearch ervice 集群上启用了精细访问控制,请确保将
LambdaExecutionRole
角色 arn 映射到至少具有权限的角色。cluster_monitor
-
选择执行。
-
自动化启动。
-
自动化运行手册执行以下步骤:
-
GetClusterConfiguration:
获取 OpenSearch 服务集群配置。
-
创建 AWSLambdaFunctionStack:
使用在您的账户中创建一个临时 Lambda 函数。 AWS CloudFormation Lambda 函数用于运行服务。 OpenSearch APIs
-
WaitForAWSLambdaFunctionStack:
等待 CloudFormation 堆栈完成。
-
GetClusterMetricsFromCloudWatch:
获取与 Amazon CloudWatch ClusterStatus CPUUtilization、和 Pr JVMMemory ess OpenSearch ure Service 集群相关的指标及其创建日期。
-
RunOpenSearchAPIs:
使用 Lambda 函数调用 OpenSearch 服务 APIs 并分析集群指标数据,以诊断红色或黄色集群状态的原因。
-
删除 AWSLambdaFunctionStack:
删除您的账户中由此自动化创建的 Lambda 函数。
-
-
完成后,查看“输出”部分以了解执行的详细结果。
-
RootCause:
概述已确定的集群运行状况处于红色或黄色状态的原因。
-
IssueDescription:
提供有关集群为何处于红色或黄色状态以及使集群恢复到绿色状态的可能步骤的详细信息。
-
参考
Systems Manager Automation
AWS 服务文档
-
有关更多信息,请参阅 Amazon OpenSearch 服务疑难解答