如何解決 Amazon OpenSearch Service 中的「無法還原索引 [.kibana]」錯誤?

1 分的閱讀內容
0

當我嘗試從 Amazon OpenSearch Service 中的手動快照還原索引時,還原失敗並顯示錯誤訊息。

解決方法

Amazon OpenSearch Service 監控 .kibana 索引,並在刪除索引後重新建立該索引。此行為可能會導致還原失敗,並顯示下列錯誤訊息:

{
    "error": {
        "root_cause": [{
            "type": "snapshot_restore_exception",
            "reason": "[repository-name:snapshot-name/1A2B34aZQFWQpFOYYJfxmQ] cannot restore index [.kibana] because an open index with same name already exists in the cluster. Either close or delete the existing index or restore the index under a different name by providing a rename pattern and replacement name"
        }],
        "type": "snapshot_restore_exception",
        "reason": "[repository-name:snapshot-name/1A2B34aZQFWQpFOYYJfxmQ] cannot restore index [.kibana] because an open index with same name already exists in the cluster. Either close or delete the existing index or restore the index under a different name by providing a rename pattern and replacement name"
    },
    "status": 500
}

若要解決此問題,請執行下列步驟:

1.    還原索引並重新命名 .kibana 索引,如下所示:

# restore indices.   $ curl -XPOST -H 'Content-Type: application/json' 'https://your-domain-end-point/_snapshot/your-repository-name/your-snapshot-name/_restore' -d'
{
    "indices": "*",
    "ignore_unavailable": true,
    "include_global_state": false,
    "rename_pattern": ".kibana",
    "rename_replacement": "restored_.kibana"
}

在此範例中,.kibana 索引會重新命名為 "restored_.kibana"。

2.    使用 _reindex API 操作將 "restored_.kibana" 重新命名為 ".kibana",如下所示:

# reindex restored_.kibana to .kibana
$ curl -XPOST -H 'Content-Type: application/json' 'https://your-domain-end-point/_reindex' -d'
{
    "source": {
        "index": "restored_.kibana"
    },
    "dest": {
        "index": ".kibana"
    }
}

您現在可以從手動快照還原索引。

AWS 官方
AWS 官方已更新 1 年前