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.
Solutions from above issue are:
- To specify the network interface. Set
network.host: _eth0_
instead ofnetwork.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"