Get Hands-on with Amazon EKS - Workshop Event Series
Whether you're taking your first steps with Kubernetes or you're an experienced practitioner looking to sharpen your skills, our Amazon EKS workshop series delivers practical, real-world experience that moves you forward. Learn directly from AWS solutions architects and EKS specialists through hands-on sessions designed to build your confidence with Kubernetes. Register now and start building with Amazon EKS!
如何解决我的 OpenSearch Service 集群中的手动快照错误?
当我恢复我的 Amazon OpenSearch Service 集群的手动快照并尝试注册或访问存储库时,我收到了错误。
解决方法
如果您未完成正确的 OpenSearch Service 版本迁移过程,则会收到错误。要解决此问题,请根据您收到的错误完成相应的解决方法。
403 Unauthorized 错误
如果您在 OpenSearch Service 域上激活了精细访问控制 (FGAC),则可能会在创建快照时收到类似于以下的错误消息:
"type: security_exception,
reason: no permissions for [cluster:admin/repository/put] and User [name=arn:aws:iam::012345678912:user/username, backend_roles=[], requestedTenant=null]
status: 403"
当您未提供正确的凭证时,将会出现上述错误。
要解决此问题,请运行以下 curl 命令,在创建手动快照时指定 username:password 参数:
curl -XPUT -u 'username:password' 'opensearch-domain-endpoint/_snapshot/snapshot-repository-name/snapshot-name'
**注意:**要为 OpenSearch Service 域激活 FGAC,您必须是超级用户。您可以使用超级用户名称和密码,也可以将 AWS Identity and Access Management (IAM) 角色设置为超级用户。当您访问集群快照时,请指定您的超级用户凭证或 IAM 角色。如果您指定 IAM 角色,则 IAM 角色必须使用 AWS 签名版本 4 对 HTTP 请求进行签名。有关 FGAC 和 IAM 角色的详细信息,请参阅创建和管理 OpenSearch Service 域。
您还必须将 manage_snapshots 角色映射到 IAM 角色,并注册快照存储库。manage_snapshots 角色必须具有 IAM:PassRole 权限才能代入 IAM 角色。有关详细信息,请参阅先决条件。
illegal_state_exception
如果您使用 Amazon Simple Storage Service (Amazon S3) 存储桶为多个域创建手动快照,您会收到一条类似于以下的错误消息:
"type: illegal_state_exception
reason: Can't get text on a FIELD_NAME at 1:1838
status: 500"
要解决上述错误,请创建新的 Amazon S3 存储桶并创建手动快照,或者清除现有存储桶中的所有数据。
Repository_missing_exception
在创建手动索引快照之前,您必须向 OpenSearch Service 注册手动快照存储库。您还必须满足手动快照先决条件。
如果您未注册快照存储库、存储库名称不正确,或您未满足先决条件,则会收到以下错误消息:
"type: repository_missing_exception
reason: [snapshot-repository-name] missing
status: 404"
Concurrent_snapshot_execution_exception
如果您在另一个快照正在创建时尝试创建新快照,则会收到以下错误消息:
type: concurrent_snapshot_execution_exception
reason: [snapshot-repository-name:snapshot-name] a snapshot is already running"
要检查是否有其他快照正在创建中,请运行以下 curl 命令:
curl -XGET 'opensearch-domain-endpoint/_snapshot/_status'
如果有快照正在创建中,请等待当前快照创建完成。如果您的快照处于卡滞状态,请检查每小时的快照历史记录。有关详细信息,请参阅为什么我无法删除索引或升级我的 OpenSearch Service 集群?
Snapshot_restore_exception
如果您将数据从本地集群迁移到 OpenSearch Service 域,则可能会收到以下错误消息:
type: snapshot_restore_exception
reason: [manual-snapshot-repo:my-manual-snapshot1/HPOcIJryTj6a6GJvyP79bw] the snapshot was created with Elasticsearch version [6.8.0] which is higher than the version of this node [6.7.0]
status: 500"
当您为某个现有集群创建快照时,如果该集群运行的 Amazon Elasticsearch 版本与 OpenSearch Service 版本不一致,将会出现上述错误。要解决此问题,请升级您的 Elasticsearch 版本。或者,使用远程重新索引 API 操作迁移您的索引。
如果您激活了域的 FGAC 并尝试从快照中恢复索引,则可能会收到以下错误消息:
"type: security_exception
reason: no permissions for [] and User [name=username, backend_roles=[], requestedTenant=]
status: 403"
要解决上述错误,请运行以下 curl 命令以排除安全索引:
curl -XPOST -u 'username:password' "https://opensearch-domain-endpoint/_snapshot/snapshot-repository/snapshot-id/_restore" -H 'Content-Type: application/json' -d' { "indices": "-.opensearch*,-.opendistro*,-.kibana*" }'
**注意:**在上述命令中,请将示例值替换为您的值。
a_w_s_security_token_service_exception
如果与您的手动快照关联的 IAM 角色没有为 es.amazonaws.com 建立信任关系,则您会收到以下错误消息:
"type: repository_exception
reason: [es_01082021_repo] Could not determine repository generation from root blobs
type: i_o_exception
reason: Exception when listing blobs by prefix [index-]
type: a_w_s_security_token_service_exception
reason: a_w_s_security_token_service_exception: User: arn:aws:sts::332315457451:assumed-role/cp-sts-grant-role/swift-us-west-2-prod-679203657591 is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::679203657591:role/ES_Backup_Role (Service: AWSSecurityTokenService; Status Code: 403; Error Code: AccessDenied; Request ID: 36d09b93-d94f-457e-8fa5-b0a50ba436c3)
status: 500"
要解决此问题,请确保在注册快照存储库时指定与手动快照关联的 IAM 角色。如果您没有 IAM 角色,请创建一个。
此外,请检查 IAM 角色的信任关系是否在 Principal 语句中指定了 OpenSearch Service。
信任关系示例:
{ "Version": "2012-10-17", "Statement": [{ "Sid": "", "Effect": "Allow", "Principal": { "Service": "es.amazonaws.com" }, "Action": "sts:AssumeRole" }] }
PARTIAL 快照状态
快照可能会因以下原因进入 PARTIAL 状态:
如果快照处于 PARTIAL 状态,则表明 OpenSearch Service 未存储某个分片的数据。您可以从处于 partial 状态的快照中恢复数据,但必须使用较早的快照来恢复缺失的索引。要检查您的集群是否处于 PARTIAL 状态,请查看您的快照历史记录。
Amazon S3 Glacier 存储类别问题
如果您将恢复后的快照存储在某个 Amazon S3 Glacier 存储类别中,请不要对该存储桶应用 Amazon S3 Glacier 生命周期规则。手动快照不支持 S3 Glacier 存储类别。如果您对存储桶应用 S3 Glacier 生命周期策略,请将移至该存储桶的对象移回标准存储类别。
将对象移回后,您可以从快照中恢复这些对象。有关详细信息,请参阅先决条件。
相关信息
如何解决 Amazon OpenSearch Service 中的"cannot restore index [.kibana]"错误?
- 语言
- 中文 (简体)
