# Why the node is not master-eligible?

**URL:** <https://discuss.elastic.co/t/why-the-node-is-not-master-eligible/205651>\
**Category:** Elasticsearch\
**Created:** [October 29, 2019, 11:18am UTC](https://discuss.elastic.co/t/why-the-node-is-not-master-eligible/205651 "2019-10-29T11:18:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nee\_Defeng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nee_defeng/32/45771_2.png) [@Nee\_Defeng](https://discuss.elastic.co/u/Nee_Defeng)\
**Post date:** [October 29, 2019, 11:18am UTC](https://discuss.elastic.co/t/why-the-node-is-not-master-eligible/205651/1 "2019-10-29T11:18:13Z")

</div>

I started the ES cluster in docker following the docker-compose template (changing the es01/es02 to nes01/nes02 to avoid the name conflict).

```
sni@elk:~$ sudo curl http://localhost:9200/_cat/nodes?v
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
172.28.0.3 27 23 75 5.74 2.61 1.40 dilm - nes01
172.28.0.2 27 23 75 5.74 2.61 1.40 dilm * nes02

```

I thought the nes01 should be the master-eligible node with the setting of '- cluster.initial\_master\_nodes=es01,es02' and it should show 'm' but it was shown as '-' above. Is my understanding wrong?

When I stop the nes02 node, the nes01 is not elected as master:

```
sni@elk:~$ sudo curl http://localhost:9200/_cat/nodes?v
{"error":{"root_cause":[{"type":"master_not_discovered_exception","reason":null}],"type":"master_not_discovered_exception","reason":null},"status":503}sni@elk:~$

```

The template is here:  
[https://www.elastic.co/guide/en/elasticsearch/reference/7.4/docker.html#docker-prod-cluster-composefile](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/docker.html#docker-prod-cluster-composefile)

docker-compose.yml:

```
version: '2.2'
services:
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.4.1
    container_name: es01
    environment:
      - node.name=es01
      - discovery.seed_hosts=es02
      - cluster.initial_master_nodes=es01,es02
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata01:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - esnet
  es02:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.4.1
    container_name: es02
    environment:
      - node.name=es02
      - discovery.seed_hosts=es01
      - cluster.initial_master_nodes=es01,es02
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata02:/usr/share/elasticsearch/data
    networks:
      - esnet

volumes:
  esdata01:
    driver: local
  esdata02:
    driver: local

networks:
  esnet:
```

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [October 29, 2019, 12:11pm UTC](https://discuss.elastic.co/t/why-the-node-is-not-master-eligible/205651/2 "2019-10-29T12:11:19Z")

</div>

> [@Nee\_Defeng](#):
>
> I thought the nes01 should be the master-eligible node with the setting of '- cluster.initial\_master\_nodes=es01,es02' and it should show 'm' but it was shown as '-' above. Is my understanding wrong?

Yes. Nodes are master-eligible by default, but you can make them master-ineligible by setting `node.master: false` in their config files. This is independent of the `cluster.initial_master_nodes` setting.

In your case, both nodes are master-eligible because they have an `m` in their `node.role` column entries (`dilm`). However a resilient cluster requires at least three master-eligible nodes.

---

<div class="post-metadata">

**Author:** ![Nee\_Defeng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nee_defeng/32/45771_2.png) [@Nee\_Defeng](https://discuss.elastic.co/u/Nee_Defeng)\
**Post date:** [October 29, 2019, 9:25pm UTC](https://discuss.elastic.co/t/why-the-node-is-not-master-eligible/205651/3 "2019-10-29T21:25:35Z")

</div>

Oh, thanks David, I think the 'm' was under the 'master' column, got it.

Follow up question on this is, if I stop the current master node (nes02 in this case), should nes01 node elect itself as the new master?

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [October 29, 2019, 10:02pm UTC](https://discuss.elastic.co/t/why-the-node-is-not-master-eligible/205651/4 "2019-10-29T22:02:03Z")

</div>

> [@Nee\_Defeng](#):
>
> if I stop the current master node (nes02 in this case), should nes01 node elect itself as the new master?

No, you would need three master-eligible nodes for this.

---

<div class="post-metadata">

**Author:** ![Nee\_Defeng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nee_defeng/32/45771_2.png) [@Nee\_Defeng](https://discuss.elastic.co/u/Nee_Defeng)\
**Post date:** [October 29, 2019, 10:10pm UTC](https://discuss.elastic.co/t/why-the-node-is-not-master-eligible/205651/5 "2019-10-29T22:10:22Z")

</div>

Perfect, just you described!

---

<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 26, 2019, 10:10pm UTC](https://discuss.elastic.co/t/why-the-node-is-not-master-eligible/205651/6 "2019-11-26T22:10:22Z")

</div>

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