How to set up a highly available elasticsearch cluster locally?

I am new to Elasticsearch and I want to set up a highly available Elasticsearch cluster on one machine to test and learn how to use Elasticsearch. I hope that when the master node fails, one of the other nodes will take over and become the master node. On my machine, I set up an Elasticsearch cluster consisting of 3 nodes, a master node and two data nodes, but when I stopped the master node, none of the other nodes took over and became the master node, here is my config for the three nodes (used version of elasticsearch is 7.9.2):

# master node config.
cluster.name:demo-cluster
node.name: "es-node-1"
node.master: true
node.data: false
discovery.zen.minimum_master_nodes: 2
#  data node 1 config.
cluster.name:demo-cluster
node.name: "es-node-2"
node.master: false
node.data: true
discovery.zen.minimum_master_nodes: 2
# data node 2 config.
cluster.name:demo-cluster
node.name: "es-node-3"
node.master: false
node.data: true
discovery.zen.minimum_master_nodes: 2

Does anyone have an idea please?

You need all nodes to be master eligible.
I'd encourage keeping all the default values for node.data and node.master.

1 Like

In addition to what David said, I suggest you read the notes in the manual on setting up a HA cluster with three nodes. That whole section of the manual is probably of interest to you.

2 Likes

You mean by keeping all the default values for node.data and node.master. I don't specify the master nodes and the data nodes even though I have n nodes and I let elasticsearch do it for me, is that right? I’m sorry if I ask a very stupid questions but I have no knowledge in elasticsearch, and soon we will install an elasticsearch cluster for one of our customers, and I need to quickly become familiar with elasticsearch.

You should really attend our trainings then to learn how to do the right things.
And/or buy a support for your customer so they will get a license and support.
Or deploy on cloud.elastic.co.

1 Like

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