带有docker的Elasticsearch集群在Windows中组合

时间:2017-05-18 14:12:31

标签: elasticsearch docker-compose

我在 Windows 中使用 Docker 17.04.0-ce 撰写1.12.0

我想创建一个包含3个 Elasticsearch 节点的集群(所有节点都在同一个IP上但在不同的端口上)。我使用的图像是: docker.elastic.co/elasticsearch/elasticsearch:5.4.0

当我编写以下yml并检查 Cerebro 中的状态时,我发现实际上没有形成任何集群(每个节点都看不到其他节点)。 任何想法可能是什么问题?

version: '2'

services:

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.4.0
    container_name: es_1
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      - cluster.name=cp-es-cluster
      - node.name=cloud1
      - http.cors.enabled=true
      - http.cors.allow-origin="*"
      - network.host=0.0.0.0
      - discovery.type=zen
      - network.publish_host=192.168.99.100
      - discovery.zen.minimum_master_nodes=1
      - xpack.security.enabled=false
      - xpack.monitoring.enabled=false
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g -XX:-AssumeMP"
    networks:
      - docker_elk

  elasticsearch_2:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.4.0
    container_name: es_2
    ports:
      - "9201:9200"
      - "9301:9300"
    links:
      - elasticsearch
    environment:
      - cluster.name=cp-es-cluster
      - node.name=cloud2
      - http.cors.enabled=true
      - http.cors.allow-origin="*"
      - network.host=0.0.0.0
      - discovery.type=zen
      - "discovery.zen.ping.unicast.hosts=192.168.99.100:9200"
      - network.publish_host=192.168.99.100
      - discovery.zen.minimum_master_nodes=1
      - xpack.security.enabled=false
      - xpack.monitoring.enabled=false
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g -XX:-AssumeMP"
    networks:
      - docker_elk

  elasticsearch_3:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.4.0
    container_name: es_3
    ports:
      - "9202:9200"
      - "9302:9300"
    links:
      - elasticsearch
    environment:
      - cluster.name=cp-es-cluster
      - node.name=cloud3
      - http.cors.enabled=true
      - http.cors.allow-origin="*"
      - network.host=0.0.0.0
      - discovery.type=zen
      - "discovery.zen.ping.unicast.hosts=192.168.99.100:9200"
      - network.publish_host=192.168.99.100
      - discovery.zen.minimum_master_nodes=1
      - xpack.security.enabled=false
      - xpack.monitoring.enabled=false
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g -XX:-AssumeMP"
    networks:
      - docker_elk

  cerebro:
    image: yannart/cerebro:0.6.5
    container_name: cerebro
    networks:
      - docker_elk
    ports:
      - "9000:9000"
    depends_on:
      - elasticsearch

networks:
  docker_elk:
    driver: bridge

0 个答案:

没有答案