ElasticSearch - DockerSwarm : Unable to discover nodes in cluster

Hi,

I am trying to configure elasticsearch and kibana on 3-node docker swarm. Here is the compose yaml file being used:

==========
version: '3.3'
services:
elastic01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
container_name: elastic01
volumes:

  • kesdata01:/usr/share/elasticsearch
    ports:
  • 9200:9200
  • 9300:9300
    environment:
  • node.name=192.xxx.x.xxx -----> // IP Address Host1
  • cluster.name=elk
  • discovery.seed_hosts=IP Address Host2,IP Address Host3
  • cluster_initial_master_nodes=IP Address Host2,IP Address Host3,IP Address Host1
  • "ES_JAVA_OPTS=-Xms256m -Xmx256m"
  • bootstrap.memory_lock=false

elastic02:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
container_name: elastic02
volumes:

  • kesdata02:/usr/share/elasticsearch
    environment:
  • node.name=192.xxx.x.xxx
  • cluster.name=elk
  • discovery.seed_hosts=IP Address Host3,IP Address Host1
  • cluster_initial_master_nodes=IP Address Host2,IP Address Host3,IP Address Host1
  • "ES_JAVA_OPTS=-Xms256m -Xmx256m"
  • bootstrap.memory_lock=false

elastic03:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
container_name: elastic03
volumes:

  • kesdata03:/usr/share/elasticsearch
    environment:
  • node.name=192.xxx.x.xxx
  • cluster.name=elk
  • discovery.seed_hosts=IP Address Host2,IP Address Host1
  • cluster_initial_master_nodes=IP Address Host2,IP Address Host3,IP Address Host1
  • "ES_JAVA_OPTS=-Xms256m -Xmx256m"
  • bootstrap.memory_lock=false

kibana01:
image: docker.elastic.co/kibana/kibana:7.6.2
container_name: kibana01
volumes:

  • kibgit:/usr/share/kibana
    ports:
  • "5601:5601"
    environment:
    ELASTICSEARCH_HOSTS: http://IP Address Host1:9200
    ELASTICSEARCH_URL: http://IP Address Host1:9200
    depends_on:
  • elastic01
  • elastic02
  • elastic03
    =================

The containers are running fine and the elasticsearch on those are running without any issue. But the master node is not elected and the nodes are not discovered. Here is the same log:

"at java.lang.Thread.run(Thread.java:830) [?:?]"] }
{"type": "server", "timestamp": "2020-05-12T22:38:11,065Z", "level": "DEBUG", "component": "o.e.a.s.m.TransportMasterNodeAction", "cluster.name": "elk", "node.name": "192.xxx.x.xxx", "message": "timed out while retrying [indices:admin/get] after failure (timeout [30s])" }

{"type": "server", "timestamp": "2020-05-12T22:38:13,566Z", "level": "DEBUG", "component": "o.e.a.s.m.TransportMasterNodeAction", "cluster.name": "elk", "node.name": "192.xxx.x.xxx", "message": "no known master node, scheduling a retry" }

==========
And when I check the cluster status, here is the error received:

{ "error" : { "root_cause" : [ { "type" : "master_not_discovered_exception", "reason" : null } ], "type" : "master_not_discovered_exception", "reason" : null }, "status" : 503 }

Can you please help me out in resolving this issue as to why the master node is not getting elected and other nodes discovered. Do I need to add any additional parameters in my compose yaml file?
Thanks in advance

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