首页 > 解决方案 > 添加更多节点(或节点丢失)后未分配主分片

问题描述

一些索引主分片处于未分配状态,它显示一个红色指示器。如果我运行GET _cluster/allocation/explain,它将提供如下详细信息:

"unassigned_info": {
    "reason": "ALLOCATION_FAILED",
    "at": "2018-06-19T00:29:17.781Z",
    "failed_attempts": 5,
    "delayed": false,
    "details": "failed to create shard, failure IOException[failed to obtain in-memory shard lock]; nested: ShardLockObtainFailedException[[log_2018_05][10]: obtaining shard lock timed out after 5000ms]; ",
    "allocation_status": "deciders_no"
}

这在我们的生产环境中发生了两次。曾经是多个数据节点在一次网络断开时丢失。另一次是我们在环境中添加了另外 2 个数据节点。

这应该如何处理?

标签: elasticsearchtimeout

解决方案


原因是主分片处于未分配状态。

Elastic 的支持建议使用以下 API 调用,它将重试之前失败的分片分配:

 POST _cluster/reroute?retry_failed

这应该会使未分配的主分片重新路由到可用节点,并且集群应该从红色状态变为黄色状态(这意味着所有主分片都正常,副本未准备好)


推荐阅读