# Unable to elect master node in ecs elastic cluster

**URL:** <https://discuss.elastic.co/t/unable-to-elect-master-node-in-ecs-elastic-cluster/205064>\
**Category:** Elasticsearch\
**Created:** [October 24, 2019, 12:29pm UTC](https://discuss.elastic.co/t/unable-to-elect-master-node-in-ecs-elastic-cluster/205064 "2019-10-24T12:29:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![devops1](https://avatars.discourse-cdn.com/v4/letter/d/0ea827/32.png) [@devops1](https://discuss.elastic.co/u/devops1)\
**Post date:** [October 24, 2019, 12:29pm UTC](https://discuss.elastic.co/t/unable-to-elect-master-node-in-ecs-elastic-cluster/205064/1 "2019-10-24T12:29:04Z")

</div>

We have 4 node elasticsearch ecs cluster. now problem is two nodes keep restarting elastic search containers and other two stable containers.

but unable to get masternode.

bash-4.1# cat /usr/share/elasticsearch/config/elasticsearch.yml  
script.inline: true  
cloud.aws.access\_key: AKIAJXFMPDJ4GTC63CXQ  
cloud.aws.secret\_key: 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  
cloud.aws.region: us-east-1  
repositories.s3.bucket: "mpt-elk-snapshots"

node.master: true  
node.data: true

xpack.security.enabled: false

cluster.name: cluster-prod  
network.host: 0.0.0.0  
network.publish\_host: _ec2:privateIp_  
discovery.type: ec2  
discovery.ec2.any\_group: false  
discovery.ec2.groups: sg-\*\*\*\*\*  
discovery.zen.hosts\_provider: ec2  
discovery.zen.minimum\_master\_nodes: 3  
#discovery.zen.ping.multicast.enabled: false

working two nodes getting this output on health.

# curl -XGET 'localhost:9200/\_cluster/health?pretty'

{  
"error" : {  
"root\_cause" : [  
{  
"type" : "master\_not\_discovered\_exception",  
"reason" : null  
}  
],  
"type" : "master\_not\_discovered\_exception",  
"reason" : null  
},  
"status" : 503  
}

please help me to resolve this issue

# curl -XGET '[http://localhost:9200](http://localhost:9200)'

{  
"name" : "casXLJFLD",  
"cluster\_name" : "prod-cluster",  
"cluster\_uuid" : "QbooN9HaTnSRJClksjdf4Zy1aw",  
"version" : {  
"number" : "5.5.1",  
"build\_hash" : "23c4swdo",  
"build\_date" : "2017-07-18T20:44:24.823Z",  
"build\_snapshot" : false,  
"lucene\_version" : "6.6.0"  
},  
"tagline" : "You Know, for Search"  
}

---

<div class="post-metadata">

**Author:** ![devops1](https://avatars.discourse-cdn.com/v4/letter/d/0ea827/32.png) [@devops1](https://discuss.elastic.co/u/devops1)\
**Post date:** [October 25, 2019, 3:42am UTC](https://discuss.elastic.co/t/unable-to-elect-master-node-in-ecs-elastic-cluster/205064/2 "2019-10-25T03:42:02Z")

</div>

Elasticsearch service with in the docker container and it is taking more time to start service. As part of ECS setup ELB/ALB will look for health check of container and if container is not health with in the time frame it will automatically stops the container and try to start new container.

Before we have 30 sec internal for 2 times. If container is not health with 60 secs (1 mins) it stops running container and start a new one.

So health checks are failing all the time due to elastic search service is taking around 2 mins to start. and containers constantly rebuilding all the time.

we increased health check time in ELB to check 5 times (2 1/2 mins) before stopping container. Issue resolved.

---

<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:** [November 22, 2019, 3:52am UTC](https://discuss.elastic.co/t/unable-to-elect-master-node-in-ecs-elastic-cluster/205064/3 "2019-11-22T03:52:13Z")

</div>

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