# Why doesn't elect master node?

**URL:** <https://discuss.elastic.co/t/why-doesnt-elect-master-node/229190>\
**Category:** Elasticsearch\
**Created:** [April 22, 2020, 6:39am UTC](https://discuss.elastic.co/t/why-doesnt-elect-master-node/229190 "2020-04-22T06:39:53Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![hgdo](https://avatars.discourse-cdn.com/v4/letter/h/7cd45c/32.png) [@hgdo](https://discuss.elastic.co/u/hgdo)\
**Post date:** [April 22, 2020, 6:39am UTC](https://discuss.elastic.co/t/why-doesnt-elect-master-node/229190/1 "2020-04-22T06:39:53Z")

</div>

Hi.

I created a Elasticsearch cluster with 2 servers.  
Elasticsearch Cluster version is 7.6.2.  
Each server has three master nodes.

I am currently doing a failover test.  
First, if you kill server 1 that has a master node, the master node is elected from server 2.  
Second, if you restart server 1 and kill server 2, the master node is not elected from server 1.  
I want to know why the Masternode is not elected from the second.

Thank you.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 22, 2020, 6:44am UTC](https://discuss.elastic.co/t/why-doesnt-elect-master-node/229190/2 "2020-04-22T06:44:18Z")

</div>

> [@hgdo](#):
>
> the master node is not elected from server 1

What node on what server is elected?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [April 22, 2020, 6:47am UTC](https://discuss.elastic.co/t/why-doesnt-elect-master-node/229190/3 "2020-04-22T06:47:13Z")

</div>

If you have a total of 6 master eligible nodes a strict majority of these (4) need to be available to elect a master. You can therefore not have a highly available cluster with just 2 servers. If any of the servers went down I would expect no master to be elected. If you are seeing anything different you may have some incorrect configuration somewhere or missing a node from your cluster.

---

<div class="post-metadata">

**Author:** ![hgdo](https://avatars.discourse-cdn.com/v4/letter/h/7cd45c/32.png) [@hgdo](https://discuss.elastic.co/u/hgdo)\
**Post date:** [April 22, 2020, 6:57am UTC](https://discuss.elastic.co/t/why-doesnt-elect-master-node/229190/5 "2020-04-22T06:57:32Z")

</div>

Thank you.  
To configure a high availability cluster with 2 servers, how do you configure the nodes on each server?

---

<div class="post-metadata">

**Author:** ![hgdo](https://avatars.discourse-cdn.com/v4/letter/h/7cd45c/32.png) [@hgdo](https://discuss.elastic.co/u/hgdo)\
**Post date:** [April 22, 2020, 6:59am UTC](https://discuss.elastic.co/t/why-doesnt-elect-master-node/229190/6 "2020-04-22T06:59:49Z")

</div>

No master node was elected anywhere.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [April 22, 2020, 7:20am UTC](https://discuss.elastic.co/t/why-doesnt-elect-master-node/229190/7 "2020-04-22T07:20:19Z")

</div>

You can not do that. A minimum of 3 servers are required.

---

<div class="post-metadata">

**Author:** ![hgdo](https://avatars.discourse-cdn.com/v4/letter/h/7cd45c/32.png) [@hgdo](https://discuss.elastic.co/u/hgdo)\
**Post date:** [April 22, 2020, 7:33am UTC](https://discuss.elastic.co/t/why-doesnt-elect-master-node/229190/9 "2020-04-22T07:33:41Z")

</div>

The server I said means one os.  
That is, there are three master nodes in one os.  
The cluster consists of 2 os (server), each with 3 master nodes.

In the same sense (1 server = 1 os), is it correct to say that you need 3 servers?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [April 22, 2020, 7:57am UTC](https://discuss.elastic.co/t/why-doesnt-elect-master-node/229190/10 "2020-04-22T07:57:40Z")

</div>

In order to be able to take down a full host/server you need a minimum of 3. If you take down one out of two servers you lose half the nodes which does not allow a majority to be formed.

The third server can however be smaller as it only needs to hold a single small dedicated master node.

---

<div class="post-metadata">

**Author:** ![hgdo](https://avatars.discourse-cdn.com/v4/letter/h/7cd45c/32.png) [@hgdo](https://discuss.elastic.co/u/hgdo)\
**Post date:** [April 23, 2020, 4:55am UTC](https://discuss.elastic.co/t/why-doesnt-elect-master-node/229190/11 "2020-04-23T04:55:07Z")

</div>

Ok. I understand.  
I'll try what you said. Thank you!

---

<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:** [May 21, 2020, 4:55am UTC](https://discuss.elastic.co/t/why-doesnt-elect-master-node/229190/12 "2020-05-21T04:55:10Z")

</div>

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