0
I’m trying to climb a Cluster Elasticsearch on Docker Swarm, but I’m not succeeding in dealing with internal communication between us. The cluster knows and I can access the master on port 9200, however, when hitting the Elastic API it is possible to see that the cluster was not formed by issues related to communication between nodes.
Instruction to up the service:
docker stack deploy -c docker-stack.yml elastic
Docker-stack.yml
version: '3.7'
services:
es-master:
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
hostname: "{{.Node.Hostname}}"
environment:
HOSTNAME: "{{.Node.Hostname}}"
ES_JAVA_OPTS: "-Xmx256m -Xms256m"
ELASTIC_PASSWORD: "password"
configs:
- source: elastic_config
target: /usr/share/elasticsearch/config/elasticsearch.yml
deploy:
mode: global
placement:
constraints:
- "node.role==manager"
ports:
- 9200:9200
- 9300:9300
networks:
- elastic
es-data:
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
hostname: "{{.Node.Hostname}}"
environment:
HOSTNAME: "{{.Node.Hostname}}"
ES_JAVA_OPTS: "-Xmx256m -Xms256m"
ELASTIC_PASSWORD: "password"
configs:
- source: elastic_config
target: /usr/share/elasticsearch/config/elasticsearch.yml
deploy:
mode: global
placement:
constraints:
- "node.role==worker"
networks:
- elastic
configs:
elastic_config:
file: ./elasticsearch.yml
networks:
elastic:
driver: overlay
Elasticsearch.yml
cluster.name: docker-cluster
network.host: 0.0.0.0
discovery.zen.minimum_master_nodes: 3
discovery.seed_hosts:
- node1
- node2
- node3
cluster.initial_master_nodes:
- node1
- node2
My main point of difficulty is in understanding how communication takes place within the swarm cluster. How one container could communicate with another?