Failure to write_consistency rule and Elasticsearch quorum

According to the elasticsearch documentation, the rule for the write_consistency quorum is:

quorum (> replicas / 2 + 1)

Using ES 0.19.10, with 16 skulls / 3 replicas, we get 16 primary fragments of 48 replicas

By launching 2 nodes, we will have 16 (primary) + 16 (replicas) = ​​32 active fragments.

To comply with the quorum rule, a quorum> 48/2 + 1 = 25 active fragments.

Now, testing this proves differently, the write_consistency level is not executed (the time it takes to write operations) until 3 nodes are started. This approach makes sense, since we can get a split brain between groups of 2 nodes each in this setup, but I don’t quite understand how this rule should work? Am I using the wrong numbers here?

+8
elasticsearch
source share
1 answer

The number of primary fragments doesn't really matter, so I'm going to replace it with N.

If you have an index with N shards and 2 replicas, there are three shards in the replication group. This means that the quorum is two: primary plus one of the replicas. You need two active shards, which usually mean two active machines, to satisfy the write consistency parameter

An index with N fragments and 3 replicas has four fragments in the replication group (primary + 3 replicas), so the quorum is three.

An index with N fragments and 1 replica is a special case, since you really do not have a quorum with two fragments. With only one replica, Elasticsearch only needs one active shard (for example, primary), so the quorum parameter is identical to the one setting for this particular layout.

A few notes:

  • 0.19 is really old, you definitely need to absolutely, positively update it. I can’t even calculate how many fixes and performance improvements have been added since this version :)

  • Record configuration is just a gateway check. Before executing the indexing request, the node will poll the straw to see if write_consistency is respected. If so, it tries to execute the index and push replication. This does not guarantee that replicas will succeed ... they can easily fail, and you will see this in the answer. This is simply a mechanism to stop the indexing process if the consistency parameter is not executed.

  • Two-node “fully replicated” setup - 1 primary shard + 1 replica. Each node has a complete data set. There is no reason to have more replicas, because ES refuses to put copies of the same data on the same computer (it makes no sense, HA does not help). The inability to index is only a side effect of the consistency of the record, but this indicates a big problem with your setup :)

+5
source share

All Articles