Master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and this node must discover master-eligible nodes elasticsearch

curl -XGET 'http://127.0.0.1:9200/_cluster/health?pretty=true'
{
  "error" : {
    "root_cause" : [
      {
        "type" : "master_not_discovered_exception",
        "reason" : null
      }
    ],
    "type" : "master_not_discovered_exception",
    "reason" : null
  },
  "status" : 503
}

using docker-compose to setup two master and data nodes, getting above exception master not discovered yet.
Below is my docker-compose.yml

version: '3.3'
volumes:
  data:
    driver: local
    driver_opts:
       type: none
       device: /data1/elasticsearch 
       o: bind

services:
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.5.0
    container_name: es01
    volumes:
      - data:/usr/share/elasticsearch/data
    environment:
      - node.name=es01
      - node.master=true
      - node.data=true
      - cluster.name=apm-docker-cluster
      - discovery.seed_hosts=es02
      - cluster.initial_master_nodes=es01,es02
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms10g -Xmx10g"
      - XPACK_SECURITY_ENABLED=false
      - XPACK_MONITORING_ENABLED=false
      - XPACK_ML_ENABLED=false
      - XPACK_GRAPH_ENABLED=false
      - XPACK_WATCHER_ENABLED=false 
      - TZ=Asia/Kolkata
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    restart: "unless-stopped"
    logging:
      driver: 'json-file'
      options:
          max-size: '2m'
          max-file: '5'
    ports:
      - 9200:9200
      - 9300:9300
    extra_hosts:
      - "es01:xx.xx.xx.xx"
      - "es02:xx.xx.xx.xx"
      - "es03:xx.xx.xx.xx"
    network_mode: "bridge"
    labels:
      org.label-schema.group: "APM-monitoring"
    healthcheck:
      test: ["CMD", "curl", "--write-out", "'HTTP %{http_code}'", "--silent", "--output", "/dev/null", "http://es01:9200/"]
      retries: 10
      interval: 10s

changed network_mode: "bridge" to network_mode: "host" all working fine

1 Like

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