Aiven for Elasticsearch automatically adjusts index replication factors to ensure data availability and service functionality.
When replication factor is automatically adjusted?
number_of_replicasis too large for current cluster size, it is automatically lowered to maximum possible value (number of nodes on the cluster - 1).
number_of_replicasis 0 on a multi-node cluster, it is automatically increased to 1.
number_of_replicasis anywhere between 1 and maximum value, it is not automatically adjusted.
Lowering replication factor
When replication factor (
number_of_replicas ) is set to larger than size of the cluster,
number_of_replicas is automatically lowered, as it is not possible to replicate indexes (shards) to a larger number of nodes than what exists on the cluster. Do note number replication factor is
number_of_replicas + 1. For example, for three-node cluster, maximum
number_of_replicas is 2, which means all shards on the index are replicated to all three nodes.
Increasing replication factor
For multi-node clusters, Aiven for Elasticsearch automatically increases
number_of_replicas to 1, if it is set to 0. This is to ensure no data-loss occurs if one node is lost.
Consider disabling this if
- You are running out of disk space, but you don't need more CPU or memory capacity.
- You can easily regenerate all the data on the indexes that will have
number_of_replicas = 1.
- You are running a multi-node cluster.
To disable automatic increase of
number_of_replicas , install Aiven command-line client, and run following command:
avn service config -c disable_replication_factor_adjustment=true <your service name>
This will not lower
number_of_replicas , but in the future it will not be increased automatically. Replication factor is still automatically lowered when set to larger value than current cluster configuration allows.