Docker swarm - create a single service elasticsearch 3 node cluster

I’m trying to create a single service Elasticsearch 3 node cluster. I cannot set the cluster.initial_master_nodes environment variable appropriately.
I’m using:

redhat 7 server
docker Version: 17.09.0-ce

The below EFK.yml deploys successfully but cannot determine the master-eligible nodes.

version: "3.3"
      - discovery.seed_hosts=tasks.elasticsearch
      - discovery.type=zen
      - cluster.initial_master_nodes=node.1,node.2,node.3
      - bootstrap.memory_lock=false
      - "ES_JAVA_OPTS=-Xms8192m -Xmx8192m"
      - ELASTIC_PASSWORD=changeIt
      - 9200
      - 9300
      - private
      - /opt/mount1/elasticsearch/data:/usr/share/elasticsearch/data
      - /opt/mount1/elasticsearch/logs:/usr/share/elasticsearch/logs
      mode: global
        constraints: [node.role == worker]

To deploy:
docker stack deploy -c EFK.yml EFK

Warming error message:

{"type": "server",  
"timestamp": "2021-09-28T11:26:18,867Z",  
"level": "WARN",  
"component": "o.e.c.c.ClusterFormationFailureHelper",  
"": "k-test-cluster",  
"": "node.qvf6m2d81mypjiv5ndvgq7ph6",  
<b>"message": "master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster,  
and this node must discover master-eligible nodes </b> 
[node.1, node.2, node.3] to bootstrap a cluster: have discovered <br> [{node.qvf6m2d81mypjiv5ndvgq7ph6}{1fOzv5V7SdebaX2ECmd2rQ}{zk_287GXSGSuPV4mCT2diw}{}{}{cdfhimrstw}  
{xpack.installed=true, transform.node=true}, <br> {node.98apd4okuoqu8ezjdw24j97ih}{tLwF0Tr1TtOfT2jNuGp1tA}{VphiDK9IQGS6CJG1Mfltrw}{}{}{cdfhimrstw}  
{xpack.installed=true, transform.node=true}, 
{xpack.installed=true, transform.node=true}];  
discovery will continue using [,,] from hosts providers and <br> [{node.qvf6m2d81mypjiv5ndvgq7ph6}{1fOzv5V7SdebaX2ECmd2rQ}{zk_287GXSGSuPV4mCT2diw}{}{} {cdfhimrstw}  
{xpack.installed=true, transform.node=true}]  
from last-known cluster state; node term 0, last-accepted version 0 in term 0" }

You need to ensure that the nodes have predictable names and then set them in the cluster.initial_master_nodes property.

Docker Swarm is a good fit for stateless things but Elasticsearch is very much not stateless so you might encounter various problems going down this path.

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