Hazelcast discovery with Docker Swarm

After going through a lot of R&D of deploying Hazelcast enabled apps as Docker Containers, first starting on pre-Docker 1.12 (legacy swarm, w/ mgrs/agents etc), with Registrator and Consul, ended up creating the hazelcast-consul-discovery-spi (available on GitHub).

This served its purpose well, but as Docker evolved and post 1.12 “swarm mode” came out with the entire concept of Docker “services”, coupled with the questionable future of the Registrator project itself; it was time to migrate our apps to “swarm mode” services….. however again we ran into issues w/ Hazelcast and peer discovery.

Out of this challenge I ended up creating the hazelcast-docker-swarm-discovery-spi

This works with Hazelcast 3.6-EA+ and Docker Swarm services (manager nodes) to provide automatic peer discovery of the Hazelcast cluster. This is done by interrogating the swarm manager api’s to locate peers based on shared information such as network info, service names and service labels (that are specified by you when you launch your services)

I hope others find this helpful, and please leave your feedback, pull-requests or issues on the project!

View all posts by bitsofinfo

Originally published at bitsofinfo.wordpress.com on September 13, 2017.