pires / docker-elasticsearch

Dockerfile for a base Elasticsearch image to be extended by others (allow to install plug-ins, change configuration, etc.)
Apache License 2.0
161 stars 173 forks source link

Question on ES nodes discovery in docker-compose #65

Open kikulikov opened 6 years ago

kikulikov commented 6 years ago

I'm trying to replicate a cluster setup with docker-compose. Please, see docker-compose file below.

version: '3'
services:
  elasticsearch-master:
    image: quay.io/pires/docker-elasticsearch:6.2.3_1
    container_name: elasticsearch-master
    privileged: true
    environment:
      - "HTTP_ENABLE=false"
      - "NODE_DATA=false"
      - "CLUSTER_NAME=elasticsearch"
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    networks:
      - elastic
  elasticsearch:
    image: quay.io/pires/docker-elasticsearch:6.2.3_1
    container_name: elasticsearch
    privileged: true
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      - "NODE_MASTER=false"
      - "NODE_DATA=false"
      - "CLUSTER_NAME=elasticsearch"
      - "ES_JAVA_OPTS=-Xms256m -Xmx256m"
      # - "discovery.zen.ping.unicast.hosts=[\"elasticsearch-master\"]"
    networks:
      - elastic
    depends_on:
      - elasticsearch-master
  elasticsearch-data1:
    image: quay.io/pires/docker-elasticsearch:6.2.3_1
    container_name: elasticsearch-data1
    privileged: true
    environment:
      - "NODE_MASTER=false"
      - "HTTP_ENABLE=false"
      - "CLUSTER_NAME=elasticsearch"
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "discovery.zen.ping.unicast.hosts=[\"elasticsearch-master\"]"
    depends_on:
      - elasticsearch-master
    networks:
      - elastic
  elasticsearch-data2:
    image: quay.io/pires/docker-elasticsearch:6.2.3_1
    container_name: elasticsearch-data2
    privileged: true
    environment:
      - "NODE_MASTER=false"
      - "HTTP_ENABLE=false"
      - "CLUSTER_NAME=elasticsearch"
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "discovery.zen.ping.unicast.hosts=[\"elasticsearch-master\"]"
    depends_on:
      - elasticsearch-master
    networks:
      - elastic

networks:
  elastic:
    driver: bridge

But nodes are never able to discover each other with messages like

elasticsearch           | [2018-04-20T22:13:56,503][WARN ][o.e.d.z.ZenDiscovery     ] [1ee60d4e-9387-47b7-bdcb-2a1ba408826f] not enough master nodes discovered during pinging (found [[]], but needed [1]), pinging again
elasticsearch-data1     | [2018-04-20T22:13:56,890][WARN ][o.e.d.z.ZenDiscovery     ] [bf93ab01-324d-4624-9d25-58b6611dcead] not enough master nodes discovered during pinging (found [[]], but needed [1]), pinging again

What am I possibly missing here? Thank you!

pires commented 6 years ago

I can't help at this point as I don't use docker-compose.