# Elasitcsearch cluster with docker swarm

**URL:** <https://discuss.elastic.co/t/elasitcsearch-cluster-with-docker-swarm/127712>\
**Category:** Elasticsearch\
**Created:** [April 12, 2018, 1:46am UTC](https://discuss.elastic.co/t/elasitcsearch-cluster-with-docker-swarm/127712 "2018-04-12T01:46:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![8e6d5b4d49f69e9edb4c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/8e6d5b4d49f69e9edb4c/32/95086_2.png) [@8e6d5b4d49f69e9edb4c](https://discuss.elastic.co/u/8e6d5b4d49f69e9edb4c)\
**Post date:** [April 12, 2018, 1:46am UTC](https://discuss.elastic.co/t/elasitcsearch-cluster-with-docker-swarm/127712/1 "2018-04-12T01:46:36Z")

</div>

Hi, all.  
I tried to run Elasticsearch cluster with docker swarm.  
However, there is a problem described in [https://github.com/elastic/elasticsearch-docker/issues/91#issuecomment-319679786](https://github.com/elastic/elasticsearch-docker/issues/91#issuecomment-319679786).  
Solutions from above issue are:

- To specify the network interface. Set `network.host: _eth0_` instead of `network.host: 0.0.0.0` in elasticsearch.yml
- Or not to use VIP (Virtual IP) mode. Set `endpoint_mode: dnsrr` in docker-compose.yml

I want to know the reason why VIP is a problem.  
Why elasticsearch cluster doesn't work when advertising VIP endpoint?

My configuration is:  
elasticsearch-master.yml

```
network.host: 0.0.0.0
cluster.name: docker-test-cluster
node.master: true
node.data: false
node.ingest: false
discovery.zen.ping.unicast.hosts: ["elasticsearch-master"]

```

elasticsearch-data.yml

```
network.host: 0.0.0.0
cluster.name: docker-test-cluster
node.master: false
node.data: true
node.ingest: false
discovery.zen.ping.unicast.hosts: ["elasticsearch-master"]

```

elasticsearch-coordinating-only.yml

```
network.host: 0.0.0.0
cluster.name: docker-test-cluster
node.master: false
node.data: false
node.ingest: false
discovery.zen.ping.unicast.hosts: ["elasticsearch-master"]

```

docker-compose.yml is:

```
version: "3.3"
services:
  elasticsearch-master:
    hostname: elasticsearch-master
    image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.3
    configs:
    - source: elasticsearch-master.yml
      target: /usr/share/elasticsearch/config/elasticsearch.yml
      uid: '1000'
      gid: '1000'
      mode: 0444
    networks:
    - backend

  elasticsearch-data:
    hostname: elasticsearch-data
    image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.3
    configs:
    - source: elasticsearch-data.yml
      target: /usr/share/elasticsearch/config/elasticsearch.yml
      uid: '1000'
      gid: '1000'
      mode: 0440
    environment:
    - bootstrap.memory_lock=true
    - "ES_JAVA_OPTS=-Xms32g -Xmx32g"
    volumes:
    - /elasticsearch/data:/usr/share/elasticsearch/data
    networks:
    - backend

  elasticsearch-coordinating-only:
    hostname: elasticsearch-coordinating-only
    image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.3
    configs:
    - source: elasticsearch-coordinating-only.yml
      target: /usr/share/elasticsearch/config/elasticsearch.yml
      uid: '1000'
      gid: '1000'
      mode: 0440
    environment:
    - bootstrap.memory_lock=true
    - "ES_JAVA_OPTS=-Xms32g -Xmx32g"
    networks:
    - backend
    ports:
    - "9200:9200"
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 10, 2018, 1:47am UTC](https://discuss.elastic.co/t/elasitcsearch-cluster-with-docker-swarm/127712/2 "2018-05-10T01:47:10Z")

</div>

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