分片数量

总分片数=主分片数 *(副分片数+1)

如下创建索引配置表示,总分片数=1 *(1+4),表示总共5个分片。

"settings": {
    "number_of_shards": 1,
    "number_of_replicas": 4
}

number_of_shards:每个索引的主分片数,默认值是 5 。这个配置在索引创建后不能修改。
number_of_replicas:每个主分片的副本数,默认值是 1 。对于活动的索引库,这个配置可以随时修改。

例如,我们可以创建只有 一个主分片,没有副本的小索引:

PUT /my_temp_index
{
    "settings": {
        "number_of_shards" :   1,
        "number_of_replicas" : 0
    }
}

然后,我们可以用 update-index-settings API 动态修改副本数:

PUT /my_temp_index/_settings
{
    "number_of_replicas": 1
}

相关文章:

  • 2022-02-12
  • 2022-12-23
  • 2021-09-20
  • 2021-08-11
  • 2021-07-01
  • 2021-05-23
  • 2021-09-03
猜你喜欢
  • 2021-05-23
  • 2021-04-23
  • 2021-10-06
  • 2021-08-26
  • 2021-07-14
  • 2022-12-23
  • 2021-12-02
相关资源
相似解决方案