跳至內容

如何解決 OpenSearch 服務叢集中的手動快照錯誤?

2 分的閱讀內容
0

當我還原 Amazon OpenSearch Service 叢集的手動快照,並嘗試註冊或存取儲存庫時,收到錯誤。

解決方法

如果您沒有完成正確的 OpenSearch Service 版本的遷移程序,則會收到錯誤訊息。若要對這些問題進行疑難排解,請根據您收到的錯誤訊息完成相應的解決方案。

403 未授權錯誤

如果您在 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 角色

此外,請檢查 IAM 角色的信任關係是否在 Principal 陳述式中指定了 OpenSearch Service。

信任關係範例:

{
    "Version": "2012-10-17",
    "Statement": [{
        "Sid": "",
        "Effect": "Allow",
        "Principal": {
            "Service": "es.amazonaws.com"
        },
        "Action": "sts:AssumeRole"
    }]
}

部分快照狀態

快照進入部分狀態的原因如下:

如果快照處於部分狀態,表示 OpenSearch Service 未能儲存來自碎片的資料。您可以從部分快照中還原資料,但必須使用較早的快照來還原遺失的索引。若要檢查您的叢集是否處於部分狀態,請檢查您的快照歷史記錄。

Amazon S3 Glacier 儲存類別問題

如果您將還原的快照儲存在其中一個 Amazon S3 Glacier 儲存類別中,請勿對該儲存貯體套用 Amazon S3 Glacier 生命週期規則。手動快照不支援 S3 Glacier 儲存類別。如果您對該儲存貯體套用了 S3 Glacier 生命週期政策,請將轉換到儲存貯體的物件移回標準儲存類別。

將物件移回後,您可以從快照中還原物件。如需詳細資訊,請參閱先決條件

相關資訊

如何解決 Amazon OpenSearch Service 中的 錯誤?"cannot restore index [.kibana]"

手動擷取快照

AWS 官方已更新 3 個月前