2.3.4 write behaviour with replicas set to 2

Hi all,

I am trying to understand the behaviour of ES 2.3.4 when replicas are set to 2.

The docs say that "index operations only succeed if a quorum (>replicas/2+1) of active shards are available."

I'm confused by what 'active' and 'available' mean in this context.

On my naive reading, it sounds like an index operation will fail unless all 3 shards are available (1 primary and 2 replicas) because 'quorum' means >replicas/2+1, which in my case means >2, which means 3 must be available.

If one node on my 5 node cluster fails, does that mean that I won't be able to index documents until all shards have 2 replicas available again? That's not really what I was hoping for - I was hoping that by having 2 replicas, I was insulated against a node failing, but it seems that a node failing means all indexing stops until the cluster is fully healed again?

I see that I can also set write consistency to 'one' - will that alter the behaviour of the system if one node fails?


Hmm. In the 5.5 docs, it defines a quorum as follows:

" A quorum is defined as follows:

int( (primary + number_of_replicas) / 2 ) + 1
The allowed values for consistency are one (just the primary shard), all (the primary and all replicas), or the default quorum, or majority, of shard copies.

Note that the number_of_replicas is the number of replicas specified in the index settings, not the number of replicas that are currently active"

If that is the same definition as 2.3.4 uses, then (>replicas/2+1) still means >2, using 'replicas' to include the primary shard.

Bit confusing, but hopefully can continue to index even when one node goes down, because perhaps only 2 active shards are required. The error message is also ambiguous:

"Not enough active copies to meet write consistency of [QUORUM] (have 1, needed 2)"

If I have 1 primary and 2 replicas, is that 2 active copies or 3??

OK, answering my own question. With replicas set to 2, it happily indexes documents when only 1 replica is available, so my guess is that the definition "quorum = >replicas/2+1" is incorrect.

So far in my experience, you can index documents with the quorum write behaviour:

with 0 available replicas when number of replicas is set to 0
with 0 available replicas when number of replicas is set to 1
with 1 available replica when number of replicas is set to 2

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.