# Docker elasticsearch can't find master

**URL:** <https://discuss.elastic.co/t/docker-elasticsearch-cant-find-master/208102>\
**Category:** Elasticsearch\
**Created:** [November 15, 2019, 4:04pm UTC](https://discuss.elastic.co/t/docker-elasticsearch-cant-find-master/208102 "2019-11-15T16:04:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![iukea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/iukea/32/49083_2.png) [@iukea](https://discuss.elastic.co/u/iukea)\
**Post date:** [November 15, 2019, 4:04pm UTC](https://discuss.elastic.co/t/docker-elasticsearch-cant-find-master/208102/1 "2019-11-15T16:04:05Z")

</div>

Hello, Elk buds,

Having an issue with my elasticsearch nodes discovering one another

- Elk 7.4
- Running in docker
  - the same VLan no firewalls blocking

- they are running on 2 separate compute nodes

Elk master node docker-compose file

```auto
version: '2.3'
services:
#### ELK
## Elasticsearch service
  elasticsearch:
    container_name: elasticsearch
    restart: always
    
    environment:
     - cluster.name=elastic
     - node.name=siem01-a.dal.sync.lan
     - discovery.seed_hosts=siem01-b.dal.sync.lan
     - cluster.initial_master_nodes=siem01-a.dal.sync.lan
     - bootstrap.memory_lock=true
     - "ES_JAVA_OPTS=-Xms5g -Xmx5g"
     - ES_TMPDIR=/tmp
    cap_add:
     - IPC_LOCK
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    mem_limit: 10g
    ports:
     - "127.0.0.1:9200:9200"
     - "127.0.0.1:9300:9300"
     - "127.0.0.1:9301:9305"
     
    image: "Help me elk/elasticsearch:2"
    volumes:
      - /data:/data
    network_mode: "host"

```

(node spins up and starts processing data)

Second node in the cluster Compose file (one that is having a hard time connecting)

```auto
version: '2.3'
services:
#### ELK
## Elasticsearch service
  siem01-b.dal.sync.lan:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.4.0
    container_name: siem01-b.dal.sync.lan
    environment:
      - node.name=siem01-b.dal.sync.lan
      - discovery.seed_hosts=siem01-a.dal.sync.lan
      - node.data=true
      - cluster.initial_master_nodes=siem01-a.dal.sync.lan
      - cluster.name=elastic
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - xpack.security.enabled=true
    ulimits:
      memlock:
        soft: -1
        hard: -1
    mem_limit: 10g
    ports:
     - "9200:9200"
     - "9300:9300"
     - "9301:9305"
    volumes:
      - /data:/data
    network_mode: "host"

```

```auto
Log message from node 2 
WARN", "component": "o.e.c.c.ClusterFormationFailureHelper", "cluster.name": "elastic", "node.name": "siem01-b.dal.sync.lan", "message": "master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and this node must discover master-eligible nodes

```

---

<div class="post-metadata">

**Author:** ![EricPSU](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ericpsu/32/21110_2.png) [@EricPSU](https://discuss.elastic.co/u/EricPSU)\
**Post date:** [November 15, 2019, 4:56pm UTC](https://discuss.elastic.co/t/docker-elasticsearch-cant-find-master/208102/2 "2019-11-15T16:56:10Z")

</div>

Here is an example that works for me on 6.x. These are two different servers on the same network. It uses any servers listed in the `discovery.zen.ping.unicast.hosts` list on startup to see if there is an existing cluster. If it doesn't find one, it will start its own cluster.

```
environment:
  - "cluster.name=docker-cluster"
  - "node.name=SERVER1"
  - "network.publish_host=SERVER1"
  - "discovery.zen.ping.unicast.hosts=SERVER2"
  - "xpack.security.enabled=false"
  - "xpack.monitoring.collection.enabled=true"
  - "ES_JAVA_OPTS=-Xms4g -Xmx4g"
```

---

<div class="post-metadata">

**Author:** ![iukea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/iukea/32/49083_2.png) [@iukea](https://discuss.elastic.co/u/iukea)\
**Post date:** [November 15, 2019, 5:44pm UTC](https://discuss.elastic.co/t/docker-elasticsearch-cant-find-master/208102/3 "2019-11-15T17:44:24Z")

</div>

sadly elk took out some of those settings in 7.0

---

<div class="post-metadata">

**Author:** ![iukea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/iukea/32/49083_2.png) [@iukea](https://discuss.elastic.co/u/iukea)\
**Post date:** [November 16, 2019, 8:24pm UTC](https://discuss.elastic.co/t/docker-elasticsearch-cant-find-master/208102/4 "2019-11-16T20:24:51Z")

</div>

Any recommendations elk community?

---

<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:** [November 17, 2019, 10:52am UTC](https://discuss.elastic.co/t/docker-elasticsearch-cant-find-master/208102/5 "2019-11-17T10:52:00Z")

</div>

> [@iukea](#):
>
> `WARN", "component": "o.e.c.c.ClusterFormationFailureHelper", "cluster.name": "elastic", "node.name": "siem01-b.dal.sync.lan", "message": "master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and this node must discover master-eligible nodes`

This is not the complete log message, and the missing bit is the bit that describes the problem. You'll need to share the full message.

---

<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:** [November 17, 2019, 11:20am UTC](https://discuss.elastic.co/t/docker-elasticsearch-cant-find-master/208102/6 "2019-11-17T11:20:31Z")

</div>

Also...

> [@iukea](#):
>
> ```plaintext
> - cluster.initial_master_nodes=siem01-a.dal.sync.lan
> 
> ```

From [the docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/discovery-settings.html#initial_master_nodes):

> You should not use this setting when restarting a cluster or adding a new node to an existing cluster.

You have an existing (one-node) cluster so you should not be using this setting any more.

---

<div class="post-metadata">

**Author:** ![Travis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/travis/32/54079_2.png) [@Travis](https://discuss.elastic.co/u/Travis)\
**Post date:** [November 21, 2019, 7:41am UTC](https://discuss.elastic.co/t/docker-elasticsearch-cant-find-master/208102/7 "2019-11-21T07:41:48Z")

</div>

@DavidTurner Do you know why we don't have to use this setting when restarting a cluster or adding a new node to an existing cluster ?

I didn't noticed this before, so I conserved it in my configuration, I made some operation (add anew node,rolling upgrade...) and didn't had any issue

---

<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:** [November 21, 2019, 8:07am UTC](https://discuss.elastic.co/t/docker-elasticsearch-cant-find-master/208102/8 "2019-11-21T08:07:24Z")

</div>

> [@Travis](#):
>
> Do you know why we don't have to use this setting when restarting a cluster or adding a new node to an existing cluster ?

Yes, the answer to that is [in the docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery-bootstrap-cluster.html):

> This is only required the first time a cluster starts up: nodes that have already joined a cluster store this information in their data folder for use in a [full cluster restart](https://www.elastic.co/guide/en/elasticsearch/reference/current/restart-upgrade.html), and freshly-started nodes that are joining a running cluster obtain this information from the cluster’s elected master.

That says why the setting is unnecessary, but we make a stronger statement and recommend actually removing it after bootstrapping. This is to help avoid two (surprisingly common) orchestration bugs:

1. accidentally using ephemeral storage for the master nodes
2. adjusting `cluster.initial_master_nodes` as the cluster grows and shrinks

If `cluster.initial_master_nodes` is in place then it may be possible to form a completely new cluster when restarting or adding nodes which is disastrous if that wasn't what you meant. Elasticsearch does what it can to prevent this disaster but that's very much on a best-effort basis and is not watertight. It's much safer to block new cluster formation by removing the setting once it's no longer needed.

---

<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:** [December 19, 2019, 8:07am UTC](https://discuss.elastic.co/t/docker-elasticsearch-cant-find-master/208102/9 "2019-12-19T08:07:32Z")

</div>

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