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.
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.
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.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.