gpt4 book ai didi

elasticsearch - 为什么在 Elastic 搜索中创建索引后不能更改主分片?

转载 作者:行者123 更新时间:2023-12-02 22:13:54 27 4
gpt4 key购买 nike

在Elasticsearch(ES)中,为什么我们不能在创建索引后更改主分片的数量,而我们可以随时更改副本分片的数量。我知道与主分片相比,更改副本分片的开销更少,但这似乎不是一项不可能完成的任务?

不允许有任何分布式系统概念或性能提升吗?

最佳答案

本想自己解释一下,结果发现官方已经解释清楚了Elasticsearch official guide :

Users often ask why Elasticsearch doesn’t support shard-splitting—the ability to split each shard into two or more pieces. The reason is that shard-splitting is a bad idea:

  • Splitting a shard is almost equivalent to reindexing your data. It’s a much heavier process than just copying a shard from one node to another.

  • Splitting is exponential. You start with one shard, then split into two, and then four, eight, sixteen, and so on. Splitting doesn’t allow you to increase capacity by just 50%.

  • Shard splitting requires you to have enough capacity to hold a second copy of your index. Usually, by the time you realize that you need to scale out, you don’t have enough free space left to perform the split.

In a way, Elasticsearch does support shard splitting. You can always reindex your data to a new index with the appropriate number of shards (see Reindexing Your Data). It is still a more intensive process than moving shards around, and still requires enough free space to complete, but at least you can control the number of shards in the new index.

关于elasticsearch - 为什么在 Elastic 搜索中创建索引后不能更改主分片?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48862347/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com