# Which node will be elected if the cluster have only 2 master eligible node

**URL:** <https://discuss.elastic.co/t/which-node-will-be-elected-if-the-cluster-have-only-2-master-eligible-node/114523>\
**Category:** Elasticsearch\
**Created:** [January 8, 2018, 12:44pm UTC](https://discuss.elastic.co/t/which-node-will-be-elected-if-the-cluster-have-only-2-master-eligible-node/114523 "2018-01-08T12:44:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ram\_Prasath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ram_prasath/32/45614_2.png) [@Ram\_Prasath](https://discuss.elastic.co/u/Ram_Prasath)\
**Post date:** [January 8, 2018, 12:44pm UTC](https://discuss.elastic.co/t/which-node-will-be-elected-if-the-cluster-have-only-2-master-eligible-node/114523/1 "2018-01-08T12:44:19Z")

</div>

Let us say I have nodes A(Master ) , B(Maser eligible ) & Node C (master eligible ) in a 3 node cluster and for some reason, the Node A is down and a master election is triggered since the quorum is 2 and we have two masters eligible nodes B & C in the cluster.  
So how will the voting happen between b & c

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [January 8, 2018, 12:49pm UTC](https://discuss.elastic.co/t/which-node-will-be-elected-if-the-cluster-have-only-2-master-eligible-node/114523/2 "2018-01-08T12:49:42Z")

</div>

According to the source code in [`ElectMasterService.java`](https://github.com/elastic/elasticsearch/blob/8758c541b35bda1a6494ba703b450517027d5e9f/core/src/main/java/org/elasticsearch/discovery/zen/ElectMasterService.java#L83-L97), the master-eligible node that is most likely to be elected as the new master is the one that has a higher cluster state version, i.e. the one which has the most up-to-date cluster state.

And if all master-eligible nodes have the same cluster state version, they are sorted by ID and the first one wins.

---

<div class="post-metadata">

**Author:** ![Ram\_Prasath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ram_prasath/32/45614_2.png) [@Ram\_Prasath](https://discuss.elastic.co/u/Ram_Prasath)\
**Post date:** [January 8, 2018, 12:55pm UTC](https://discuss.elastic.co/t/which-node-will-be-elected-if-the-cluster-have-only-2-master-eligible-node/114523/3 "2018-01-08T12:55:57Z")

</div>

That makes sense thanks a lot for the answer

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 5, 2018, 12:56pm UTC](https://discuss.elastic.co/t/which-node-will-be-elected-if-the-cluster-have-only-2-master-eligible-node/114523/4 "2018-02-05T12:56:08Z")

</div>

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