为什么在 Elastic 搜索中创建索引后不能更改主分片?
Why no of primary shards can't be changed once index is created in Elastic search?
在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(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.