Home > database >  ElasticSearch Replica Count Failure Modes
ElasticSearch Replica Count Failure Modes

Time:05-30

I'm researching the Elasticsearch feature to update the number of replica shards for an index. Doc: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html

PUT /my-index-000001/_settings
{
  "index" : {
    "number_of_replicas" : 2
  }
}

I was researching all the ways that this operation can fail, and there's one that I just can't figure out(without diving headlong into the source code..). What happens if the chosen number of replicas will run into a disk space contraint? Does that mean that the entire replica operation gets rolled back? Do all the additional replicas that can fit into the current limited size stay, and the remaining that don't fit, will not be generated?

For example, let's say I have an index that takes 10GB of primary shards. With max storage of 55GB. If I change the replica count to 6(and let's assume for simplicity that each replica adds 10GB -for simplicity). Does that mean that it will create 5 good replicas and fail on the 6th across all shards? Will it rollback the entire operation? Will it actually create 6 replicas for some and leave 5 for others? I can't find this information and it's very pertinent to what I want to achieve with ES operability. Thanks.

CodePudding user response:

The specified number of replicas will be created. The ones that can be assigned to a node will be assigned and the ones that cannot (either because of space or allocation awareness constraints) will be left unassigned and your cluster will go from green to yellow.

Maybe if you explain your use case and what you want to achieve, we can give a more specific answer.

  • Related