How to start Elasticsearch 7.0.0 in global mode in a docker swarm cluster?

I have a 6 node docker swarm cluster in which I would like to have 3 elasticsearch masters. The remaining nodes will be data nodes. The elasticsearch cluster will be behind a reverse proxy.

What elasticsearch configuration will I need to set to spin up an elasticsearch cluster in docker swarm global mode? I will really appreciate any suggestion.

Here is my initial docker-compose.yml: https://github.com/shazChaudhry/docker-elastic/blob/8a6dbfbbfab12f96d633f31215dc9fa90df5b47f/docker-compose.yml

Elasticsearch 6.7.0 worked very well in global mode in a docker swarm: Here is the compose file: https://github.com/shazChaudhry/docker-elastic/blob/2b0cc079b4a5755f3146facc3dc7827315cb1bbf/docker-compose.yml

I just can not work out how to start elasticsearch 7.0.0 in global mode in docker swarm

As far as I can tell, Docker Swarm doesn't offer the ability to auto-generate a set of predictable node names for the master nodes as, say, a Kubernetes StatefulSet does. This does makes bootstrapping the cluster a bit difficult. One idea: you could start with a single "bootstrap" master node with a predictable name, then add the three normal master nodes to it, then shut the bootstrap master down.

1 Like

Another idea: you can start each of your masters as a separate service with a fixed name. This is what the suggested docker-compose.yml file in the reference manual does.

Thank you very much for the suggestions. I wish there were a simpler solution.

I am not entirely sure how I am going to take Elastic stack forward with docker swarm.

Here is an example showing how to start an Elasticsearch v7.x cluster in global mode in docker swarm.

This example was tried in a two-node swarm cluster; node1 = elasticsearch master node; node2 = data node

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.