首页 文章

elasticsearch:重新启动单个节点群集时,所有主分片都变为非活动状态

提问于
浏览
1

我启动了一个新的elasticsearch集群并添加了一个新索引,然后我将其关闭 . 当我尝试再次启动它时,不再有活动的分片 . 所有分片都变为非活动状态且未分配 . 我使用下面的索引设置:

"settings": {
            "number_of_shards": 32,
            "number_of_replicas": 3
        }

这是 Health 输出:

{
  "cluster_name" : "sailcraft",
  "status" : "red",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 0,
  "active_shards" : 0,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 128,
  "number_of_pending_tasks" : 0
}

这是same problem which has been marked solved . 但我不是解决方案 .

编辑:

这是同样的问题,但我认为该帖子没有得到正确的答案 . 它说如果我们有2个以上的副本分片,我们还需要2个节点 . 我阅读了所有相关文档,并没有任何此类限制 .

EDIT2: Solution: he setting index.recovery.initial_shards provides the following: Basically, when using a local gateway, a "shard" will be recovered once a quorum of its copies are found among the nodes in the cluster. Lets take N shard, with 1 replica (2 copies for each shard). The default (quorum) means that once a singe copy of a shard is found, it will be recovered. If you have 2 replicas (3 copies), it will only recover that shard once 2 copies are found. You can set this setting, in case you lost a large number of nodes, and quorum is a too strict setting. You can actually set it on a "live" index (which is in a "red" state, obviously, because not all shards are recovered).

1 回答

  • 0

    这是the documentation提到这个 . 的确,那里是's not evident, but it':

    index.recovery.initial_shards使用本地网关时,只有在群集中可以分配仲裁分片时才会恢复特定分片 . 它可以设置为:quorum(默认值)quorum-1(或half)full full-1 . 还支持数值,例如1 .

    如果您确实希望节点运行,请在 elasticsearch.yml 文件中设置 index.recovery.initial_shards: 1 .

相关问题