Unable to create HA with Elasticsearch with 2 master nodes

I am new to ES. I am trying to set up a cluster on the same machine(Windows)
I have 2 copy of elasticsearch-7.1.1-masterA & elasticsearch-7.1.1-masterB
I am using basic version of ELK.

elasticsearch-7.1.1-masterA has following config elastisearch.yml

cluster.name: MyCluster
node.name: master-node-a
cluster.initial_master_nodes: ["master-node-a", "master-node-b"]
discovery.zen.minimum_master_nodes: 1
node.master: true
node.data: true
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12

and elasticsearch-7.1.1-masterB has following config in elasticsearch.yml

cluster.name: MyCluster
node.name: master-node-b
cluster.initial_master_nodes: ["master-node-a", "master-node-b"]
discovery.zen.minimum_master_nodes: 1
node.master: true
node.data: true
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12

So I have 2 masters eligible node. When I am starting my cluster both node get connected and one of them is becoming master node.Assume that MasterA has become master node and masterB is master eligible node. When I am stopping MasterA node then I am expecting MasterB should become master node and elastic keep on running, but I get NodeClosedException.

When 2 node cluster is up I also run kibana, but when master node down kibana also started loging expection.

Please help me out how could I test and create 2 or 3 node cluster and test High availability.

A 2-node Elasticsearch cluster can never be highly available as Elasticsearch relies on consensus and requires a majority of master eligible nodes to be present in order to function (majority of 2 is 2). You therefore need to add a master eligible node to the cluster.

1 Like