[Elasticsearch on Docker] Can't have a dedicated master node

Hello there !

On Docker, I can't succeed to have a dedicated master node in a simple 4 nodes test setup.

Master is never discovered when I use :

version: '2.2'
services:
  master1:
image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2
container_name: master1
environment:
  - node.name=master1
  - cluster.name=es-docker-cluster
  - node.master=true
  - discovery.seed_hosts=es01,es02,es03
  - cluster.initial_master_nodes=master1,es01,es02,es03
  - bootstrap.memory_lock=true
  - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
  memlock:
    soft: -1
    hard: -1
volumes:
  - master1:/usr/share/elasticsearch/data
networks:
  - elastic

  es01:
depends_on:
  - master1
image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2
container_name: es01
environment:
  - node.name=es01
  - cluster.name=es-docker-cluster
  - node.master=false
  - discovery.seed_hosts=es02,es03,master1
  - cluster.initial_master_nodes=master1,es01,es02,es03
  - bootstrap.memory_lock=true
  - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
  memlock:
    soft: -1
    hard: -1
volumes:
  - data01:/usr/share/elasticsearch/data
ports:
  - 9200:9200
networks:
  - elastic

  es02:
depends_on:
  - master1
image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2
container_name: es02
environment:
  - node.name=es02
  - cluster.name=es-docker-cluster
 - node.master=false
  - discovery.seed_hosts=es01,es03,master1
  - cluster.initial_master_nodes=master1,es01,es02,es03
  - bootstrap.memory_lock=true
  - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
  memlock:
    soft: -1
    hard: -1
volumes:
  - data02:/usr/share/elasticsearch/data
networks:
  - elastic

  es03:
depends_on:
  - master1
image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2
container_name: es03
environment:
  - node.name=es03
  - cluster.name=es-docker-cluster
  - node.master=false
  - discovery.seed_hosts=es01,es02,master1
  - cluster.initial_master_nodes=master1,es01,es02,es03
  - bootstrap.memory_lock=true
  - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
  memlock:
    soft: -1
    hard: -1
volumes:
  - data03:/usr/share/elasticsearch/data
networks:
  - elastic

volumes:
  data01:
driver: local
  data02:
driver: local
  data03:
driver: local
  master1:
driver: local

networks:
  elastic:
driver: bridge

If I remove node.master and node.data settings, it works, but using a random node as master

version: '2.2'
services:
  master1:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2
    container_name: master1
    environment:
      - node.name=master1
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es01,es02,es03
      - cluster.initial_master_nodes=master1,es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - master1:/usr/share/elasticsearch/data
    networks:
      - elastic

  es01:
    depends_on:
      - master1
    image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2
    container_name: es01
    environment:
      - node.name=es01
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es02,es03,master1
      - cluster.initial_master_nodes=master1,es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data01:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - elastic

  es02:
    depends_on:
      - master1
    image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2
    container_name: es02
    environment:
      - node.name=es02
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es01,es03,master1
      - cluster.initial_master_nodes=master1,es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data02:/usr/share/elasticsearch/data
    networks:
      - elastic

  es03:
    depends_on:
      - master1
    image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2
    container_name: es03
    environment:
      - node.name=es03
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es01,es02,master1
      - cluster.initial_master_nodes=master1,es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data03:/usr/share/elasticsearch/data
    networks:
      - elastic

volumes:
  data01:
    driver: local
  data02:
    driver: local
  data03:
    driver: local
  master1:
    driver: local

networks:
  elastic:
    driver: bridge

Elasticsearch error message : https://pastebin.com/4WUqwz4T

Any idea on why it don't accept the settings ?

Thanks for your help ! :slight_smile:

After checking docs, I applied this configuration and it's working as expected :

version: '2.2'
services:
  master1:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2
    container_name: master1
    environment:
      - node.name=master1
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=master1,master2,master3,es01,es02,es03
      - cluster.initial_master_nodes=master1,master2,master3
      - node.master=true
      - node.ingest=false
      - node.data=false
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - master1:/usr/share/elasticsearch/data
    networks:
      - elastic

  master2:
    depends_on:
      - master1
    image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2
    container_name: master2
    environment:
      - node.name=master2
      - cluster.name=es-docker-cluster
      - node.master=true
      - node.ingest=false
      - node.data=false
      - discovery.seed_hosts=master1,master2,master3,es01,es02,es03
      - cluster.initial_master_nodes=master1,master2,master3
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - master2:/usr/share/elasticsearch/data
    networks:
      - elastic

  master3:
    depends_on:
      - master1
      - master2
    image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2
    container_name: master3
    environment:
      - node.name=master3
      - cluster.name=es-docker-cluster
      - node.master=true
      - node.ingest=false
      - node.data=false
      - discovery.seed_hosts=master1,master2,master3,es01,es02,es03
      - cluster.initial_master_nodes=master1,master2,master3
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - master3:/usr/share/elasticsearch/data
    networks:
      - elastic

  es01:
    depends_on:
      - master1
      - master2
      - master3
    image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2
    container_name: es01
    environment:
      - node.name=es01
      - cluster.name=es-docker-cluster
      - node.master=false
      - discovery.seed_hosts=master1,master2,master3
      - cluster.initial_master_nodes=master1,master2,master3
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data01:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - elastic

  es02:
    depends_on:
      - master1
      - master2
      - master3
    image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2
    container_name: es02
    environment:
      - node.name=es02
      - cluster.name=es-docker-cluster
      - node.master=false
      - discovery.seed_hosts=master1,master2,master3
      - cluster.initial_master_nodes=master1,master2,master3
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data02:/usr/share/elasticsearch/data
    networks:
      - elastic

  es03:
    depends_on:
      - master1
      - master2
      - master3
    image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2
    container_name: es03
    environment:
      - node.name=es03
      - cluster.name=es-docker-cluster
      - node.master=false
      - discovery.seed_hosts=master1,master2,master3
      - cluster.initial_master_nodes=master1,master2,master3
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data03:/usr/share/elasticsearch/data
    networks:
      - elastic

volumes:
  data01:
    driver: local
  data02:
    driver: local
  data03:
    driver: local
  master1:
    driver: local
  master2:
    driver: local
  master3:
    driver: local


networks:
  elastic:
    driver: bridge

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