AWS 上的 Elasticsearch:如何修复未分配的分片?

Sou*_*eep 9 sharding amazon-web-services elasticsearch elasticsearch-5

我在 AWS Elasticsearch 上有一个索引,由于NODE_LEFT. 这是输出_cat/shards

rawindex-2017.07.04                     1 p STARTED    
rawindex-2017.07.04                     3 p UNASSIGNED NODE_LEFT
rawindex-2017.07.04                     2 p STARTED    
rawindex-2017.07.04                     4 p STARTED    
rawindex-2017.07.04                     0 p STARTED    
Run Code Online (Sandbox Code Playgroud)

在正常情况下,使用_clusteror可以很容易地重新分配这些分片_settings。但是,这些是 AWS 不允许的确切 API。我收到以下消息:

{
    Message: "Your request: '/_settings' is not allowed."
}
Run Code Online (Sandbox Code Playgroud)

根据对一个非常相似的问题的回答,我可以使用_indexAWS 允许的 API更改索引的设置。但是,它似乎index.routing.allocation.disable_allocation对我正在运行的 Elasticsearch 5.x 无效。我收到以下错误:

{
    "error": {
        "root_cause": [
            {
                "type": "remote_transport_exception",
                "reason": "[enweggf][x.x.x.x:9300][indices:admin/settings/update]"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "unknown setting [index.routing.allocation.disable_allocation] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
    },
    "status": 400
}
Run Code Online (Sandbox Code Playgroud)

我尝试将索引恢复优先级index.priority设置index.unassigned.node_left.delayed_timeout为 1 分钟,但我无法重新分配它们。

有什么方法(肮脏的或优雅的)可以在 AWS 托管的 ES 上实现这一点?

谢谢!

Mat*_*Han 17

我在 AWS Elasticsearch 6.3 版中遇到了类似的问题,即无法分配 2 个分片,并且集群状态为 RED。运行GET _cluster/allocation/explain显示原因是他们超过了默认的最大分配重试次数 5。

运行查询GET <my-index-name>/_settings揭示了每个索引可以更改的少数设置。请注意,如果您使用 AWS Elasticsearch 服务,则所有查询均采用 Kibana 格式,您可以使用这种格式。以下解决了我的问题:

PUT <my-index-name>/_settings
{
  "index.allocation.max_retries": 6
}
Run Code Online (Sandbox Code Playgroud)

GET _cluster/allocation/explain之后立即运行返回以下错误:"reason": "unable to find any unassigned shards to explain...",一段时间后问题得到解决。