I am trying to configure a 3-node docker swarm with Elasticsearch cluster on it. Here is the docker compose file used:
version: '3.3'
services:
elastic01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
container_name: elastic01
volumes:
- kesdata01:/usr/share/elasticsearch
ports:
- 9200:9200
- 9300:9300
environment:
- node.name=192.168.1.249
- cluster.name=sfty-elk
- http.port=9200
- transport.tcp.port=9300
- transport.host=localhost
- node.master=true
- network.bind_host=0.0.0.0
- network.host=0.0.0.0
- discovery.seed_hosts=192.168.1.250,192.168.1.251
- cluster_initial_master_nodes=192.168.1.249,192.168.1.250,192.168.1.251
- "ES_JAVA_OPTS=-Xms256m -Xmx256m"
- bootstrap.memory_lock=false
elastic02:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
container_name: elastic02
volumes:
- kesdata02:/usr/share/elasticsearch
environment:
- node.name=192.168.1.250
- cluster.name=sfty-elk
- transport.host=localhost
- network.bind_host=0.0.0.0
- network.host=0.0.0.0
- discovery.seed_hosts=192.168.1.249,192.168.1.251
- cluster_initial_master_nodes=192.168.1.249,192.168.1.250,192.168.1.251
- "ES_JAVA_OPTS=-Xms256m -Xmx256m"
- bootstrap.memory_lock=false
depends_on:
- elastic01
------ etc.
Here is the error in the log files
{"type": "server", "timestamp": "2020-05-13T17:53:15,428Z", "level": "INFO", "component": "o.e.t.TransportService", "cluster.name": "sfty-elk", "node.name": "192.168.1.251", "message": "publish_address {localhost/127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}"}
{"type": "server", "timestamp": "2020-05-13T17:53:25,892Z", "level": "WARN", "component": "o.e.c.c.ClusterFormationFailureHelper", "cluster.name": "sfty-elk", "node.name": "192.168.1.251", "message": "master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and [cluster.initial_master_nodes] is empty on this node: have discovered [{192.168.1.251}{1yM9Z0JxQFK1HT7kc5RauQ}{NW1nXax2Tiu1zwTKEbxErQ}{localhost}{127.0.0.1:9300}{dilm}{ml.machine_memory=33561579520, xpack.installed=true, ml.max_open_jobs=20}]; discovery will continue using [192.168.1.249:9300, 192.168.1.250:9300] from hosts providers and [{192.168.1.251}
=======================
I have being trying multiple options by mentioning attributes in the docker compose file, but still the same issue. Like: 1. Using transport.host=localhost or transport.host=192.168.1.249 2. network.bind_host=0.0.0.0
Here is the IP address of my first host:
ifconfig
br-bcfdef6bce3b: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.19.0.1 netmask 255.255.0.0 broadcast 172.19.255.255
ether 02:42:27:89:77:98 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:78:86:1e:97 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
docker_gwbridge: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.18.0.1 netmask 255.255.0.0 broadcast 172.18.255.255
inet6 fe80::42:42ff:febd:2468 prefixlen 64 scopeid 0x20<link>
ether 02:42:42:bd:24:68 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.249 netmask 255.255.252.0 broadcast 192.168.3.255
inet6 fe80::f89e:1dff:feb6:ad67 prefixlen 64 scopeid 0x20<link>
ether fa:9e:1d:b6:ad:67 txqueuelen 1000 (Ethernet)
RX packets 58365982 bytes 23016720461 (21.4 GiB)
RX errors 0 dropped 1902 overruns 0 frame 0
TX packets 13045633 bytes 1414222643 (1.3 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 141 bytes 13772 (13.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 141 bytes 13772 (13.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vethbce5267: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::5066:22ff:fef7:b87c prefixlen 64 scopeid 0x20<link>
ether 52:66:22:f7:b8:7c txqueuelen 0 (Ethernet)
RX packets 23201 bytes 3663983 (3.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32794 bytes 3479431 (3.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:05:08:60 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Can you please help out in resolving this. Am I missing any attributes in the compose file?
Thanks in advance