Hello.
I am looking for the best way to connect Docker running multiple elasticsearch instances running on two servers connected directly by fiber optic cable not using the Swarm mode (as this is not supported by Elasticsearch).
My docker-compose.yml on server 1:
version: '3.7'
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
container_name: es01
environment:
- node.name=es01
- node.master=true
- node.data=true
- discovery.seed_hosts=es02
- cluster.initial_master_nodes=es01,es02
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata01:/usr/share/elasticsearch/data
ports:
- 9201:9200
networks:
- macvlan
es02:
image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
container_name: es02
environment:
- node.name=es02
- node.master=true
- node.data=true
- discovery.seed_hosts=es01
- cluster.initial_master_nodes=es01,es02
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata02:/usr/share/elasticsearch/data
networks:
- macvlanes03:
image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
container_name: es03
environment:
- node.name=es03
- node.master=false
- node.data=true
- discovery.seed_hosts=es01
- cluster.initial_master_nodes=es01,es02
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata03:/usr/share/elasticsearch/data
networks:
- macvlanvolumes:
esdata01:
driver: local
esdata02:
driver: local
esdata03:
driver: localnetworks:
macvlan:
My docker-compose.yml on server 2 is identical, just names are changed.
Nodes are connected by:
br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether d0:94:66:19:43:02 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.2/24 brd 192.168.1.255 scope global br0
valid_lft forever preferred_lft foreveriface br0 inet static
address 192.168.1.2
netmask 255.255.255.0
bridge_ports eth2 eth3
bridge_maxwait 0
pre-up ip addr flush dev br0 >/dev/null 2>&1 || true
Thanks for the suggestions!