如何解决 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 官方已更新 10 个月前