Im trying setup 2 nodes elastic cluster with docker compose with below config on 2 servers.
My master node runs and elected as a master. But Data node cannot discover the master node.
On server 1
version: '2.0'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
container_name: elasticsearch
environment:
- cluster.name=elasticsearch
- node.name=master
- node.master=true
- network.publish_host=master-ip-address
- cluster.initial_master_nodes=master
- network.host=0.0.0.0
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms10g -Xmx10g"
- discovery.seed_hosts=master-ip-address, data-ip-address
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- dockernet
kibana:
image: docker.elastic.co/kibana/kibana:7.6.2
container_name: kibana
environment:
ELASTICSEARCH_URL: "http://elasticsearch:9200"
server.host: "172.17.0.1"
elasticsearch.hosts: "http://172.17.0.1:9200"
ports:
- 5601:5601
depends_on:
- elasticsearch
networks:
- dockernet
volumes:
esdata1:
driver: local
networks:
dockernet:
external:
name: dockernet
The above config works and start my master node.
{"type": "server", "timestamp": "2020-04-10T10:08:48,521Z", "level": "INFO", "component": "o.e.c.s.MasterService", "cluster.name": "elasticsearch", "node.name": "master", "message": "elected-as-master ([1] nodes joined)[{master}{nVIjCIFHQ4yFzrrU670mkw}{Z7zuhZ3FQ3qGvqnwPXjX_Q}{master-ip-address}{master-ip-address:9300}{dilm}{ml.machine_memory=33737482240, xpack.installed=true, ml.max_open_jobs=20} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 18, version: 215, delta: master node changed {previous [], current [{master}{nVIjCIFHQ4yFzrrU670mkw}{Z7zuhZ3FQ3qGvqnwPXjX_Q}{master-ip-address}{master-ip-address:9300}{dilm}{ml.machine_memory=33737482240, xpack.installed=true, ml.max_open_jobs=20}]}" }
Now, on the Server 2
Ive the below config in docker-compose
version: '2.0'
services:
node1:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
container_name: node1
environment:
- cluster.name=elasticsearch
- node.name=node1
- network.publish_host=data-ip-address
- cluster.initial_master_nodes=master
- node.data=true
- network.host=0.0.0.0
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms1g -Xms1g"
- discovery.seed_hosts=master-ip-address, data-ip-address
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200
- 9300:9300
networks:
- dockernet
volumes:
esdata1:
driver: local
networks:
dockernet:
external:
name: dockernet
This above server starts but it cannot connect to master node.
"message": "skipping cluster bootstrapping as local node does not match bootstrap requirements: [master-ip-address]
{"type": "server", "timestamp": "2020-04-10T10:06:18,416Z", "level": "WARN", "component": "o.e.c.c.ClusterFormationFailureHelper", "cluster.name": "elasticsearch", "node.name": "node1", "message": "master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and this node must discover master-eligible nodes [master-ip-address] to bootstrap a cluster: have discovered [{node1}{c1A4xamkQuyyxjXAgpDt8Q}{2jimVZBDTKOY3VubEcUF3A}{data-ip-address}{data-ip-address:9300}{dilm}{ml.machine_memory=4143415296, xpack.installed=true, ml.max_open_jobs=20}]; discovery will continue using [master-ip-address:9300] from hosts providers and [{node1}{c1A4xamkQuyyxjXAgpDt8Q}{2jimVZBDTKOY3VubEcUF3A}{data-ip-address}{data-ip-address:9300}{dilm}{ml.machine_memory=4143415296, xpack.installed=true, ml.max_open_jobs=20}] from last-known cluster state; node term 0, last-accepted version 0 in term 0" }
Any advise?