# Unable to connect to secondary master node, when manually stopping primary master node

**URL:** <https://discuss.elastic.co/t/unable-to-connect-to-secondary-master-node-when-manually-stopping-primary-master-node/300917>\
**Category:** Elasticsearch\
**Created:** [March 29, 2022, 7:22am UTC](https://discuss.elastic.co/t/unable-to-connect-to-secondary-master-node-when-manually-stopping-primary-master-node/300917 "2022-03-29T07:22:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dhamodharan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dhamodharan/32/78486_2.png) [@Dhamodharan](https://discuss.elastic.co/u/Dhamodharan)\
**Post date:** [March 29, 2022, 7:22am UTC](https://discuss.elastic.co/t/unable-to-connect-to-secondary-master-node-when-manually-stopping-primary-master-node/300917/1 "2022-03-29T07:22:29Z")

</div>

I got a small project so thought to go with only 2nodes ES cluster and maintain HA. Both nodes are act as Master and data node, i wanted to maintain any 1 node should be up all the time. Both machine having the same config and working fine when both nodes are available. But when i down node1, node2 showing master node not discovered. Can someone help to fix this?

```auto
###################################
my elasticsearch.yml file

cluster.name: abc-escluster
node.name: abc-es2
node.master: true
node.data: true
node.ingest: true
network.host: 0.0.0.0
discovery.seed_hosts: ["172.18.18.160","172.18.18.170"]
discovery.zen.minimum_master_nodes: 2
cluster.initial_master_nodes: ["172.18.18.160","172.18.18.170"]
node.voting_only: false
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
xpack.monitoring.collection.enabled: true
xpack.security.http.ssl.enabled: true
xpack.security.http.ssl.keystore.path: "http.p12"

```

log from node2 looks like:

```auto
########################
[2022-03-29T06:58:49,182][WARN][o.e.c.c.ClusterFormationFailureHelper] [abc-es2] master not discovered or elected yet, an election requires a node with id [gv95oj0pQbK-AAKzHtyo2w], have discovered [{vcci-es2}{owfHWxOiQ1OrJv7urv-nsA}{F6GLd6mqT7a5fyoAguXuOA}{172.18.18.170}{172.18.18.170:9300}{dilmrt}{ml.machine_memory=4067299328, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}] which is not a quorum; discovery will continue using [172.18.18.160:9300] from hosts providers and [{vcci-es2}{owfHWxOiQ1OrJv7urv-nsA}{F6GLd6mqT7a5fyoAguXuOA}{172.18.18.170}{172.18.18.170:9300}{dilmrt}{ml.machine_memory=4067299328, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}] from last-known cluster state; node term 11, last-accepted version 342 in term 11
[2022-03-29T06:58:49,277][INFO][o.e.x.s.a.AuthenticationService] [vcci-es2] Authentication of [elastic] was terminated by realm [reserved] - failed to authenticate user [elastic]
[2022-03-29T06:58:49,381][INFO][o.e.x.s.a.AuthenticationService] [vcci-es2] Authentication of [elastic] was terminated by realm [reserved] - failed to authenticate user [elastic]
##########################

```

I suspect, have created my elastic user in node1, As i have stopped the node1, the user credentials are not getting validated in node2.

How can i maintain the same state with 2node cluster. If any1 node goes down still my es dashboard shouldnt come down.

Regards,  
Dhamodharan.

---

<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:** [March 29, 2022, 7:30am UTC](https://discuss.elastic.co/t/unable-to-connect-to-secondary-master-node-when-manually-stopping-primary-master-node/300917/2 "2022-03-29T07:30:11Z")

</div>

You can not have a highly available cluster with only 2 nodes. Elasticsearch requires a majority of master eligible nodes to be available for a master to be elected, which means both nodes must be available in a two node cluster. You will need a minimum of 3 nodes for HA and could add a small voting-only dedicated master node to act as a tiebreaker. Please see [this section in the docs](https://www.elastic.co/guide/en/elasticsearch/reference/8.1/high-availability-cluster-small-clusters.html) for details.

---

<div class="post-metadata">

**Author:** ![Dhamodharan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dhamodharan/32/78486_2.png) [@Dhamodharan](https://discuss.elastic.co/u/Dhamodharan)\
**Post date:** [March 29, 2022, 8:35am UTC](https://discuss.elastic.co/t/unable-to-connect-to-secondary-master-node-when-manually-stopping-primary-master-node/300917/3 "2022-03-29T08:35:47Z")

</div>

Thanks for the information, thats fine. kindly suggest how can i bring the sec node as master when primary node down. I dont want to go with more nodes. I manually stopped node1 and tried to pullup node2, but node2 unable to validate the elastic user, as its created in node1. How can i manually bring node2 as master.  
Considering node2 as data node initially, during failure i wanna make node2 as master.

---

<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:** [March 29, 2022, 8:41am UTC](https://discuss.elastic.co/t/unable-to-connect-to-secondary-master-node-when-manually-stopping-primary-master-node/300917/4 "2022-03-29T08:41:45Z")

</div>

> [@Dhamodharan](#):
>
> how can i bring the sec node as master when primary node down

You can not. Three nodes are required.

---

<div class="post-metadata">

**Author:** ![Dhamodharan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dhamodharan/32/78486_2.png) [@Dhamodharan](https://discuss.elastic.co/u/Dhamodharan)\
**Post date:** [March 31, 2022, 7:12am UTC](https://discuss.elastic.co/t/unable-to-connect-to-secondary-master-node-when-manually-stopping-primary-master-node/300917/5 "2022-03-31T07:12:38Z")

</div>

I have configured 3nodes to make it HA and its perfectly working fine. Now my challenge is how i can i get the endpoint of the cluster for the application configuration, do we have any config to enable the dns/endpoint for the cluster?? Sharing individual host name is not a solution. Else can i go with NLB from aws??

---

<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:** [March 31, 2022, 7:32am UTC](https://discuss.elastic.co/t/unable-to-connect-to-secondary-master-node-when-manually-stopping-primary-master-node/300917/6 "2022-03-31T07:32:53Z")

</div>

Most clients accept a list of hostnames and support load balancing and failover across these. If you require a single endpoint you probably need to put a load balancer in front of the cluster.

---

<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:** [April 28, 2022, 7:33am UTC](https://discuss.elastic.co/t/unable-to-connect-to-secondary-master-node-when-manually-stopping-primary-master-node/300917/7 "2022-04-28T07:33:42Z")

</div>

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