How to Auto discovery Two or More Application Using Hazelcast in Docker?

241 views Asked by At

I have an application that uses hazelcast. I am running two containers related to this application in docker emvironment. The configuration of hazelcast is same(group name, password, multicast or tcp-ip for network join) However, they cannot see each other and cannot create cluster group. Each of them create its own cluster.

The question is that:

  • How should I define multicast network for docker in hazelcast.xml? —-For example, defining just multicast group and port did not work for me.(But it was working when two virtual machines were used)
  • When I tried network configuration for tcp-ip enabled and assigned docker defined ip addresses as members in hazelcast.xml, it also did not work)
1

There are 1 answers

1
Neil Stevenson On BEST ANSWER

This and this should get you going.

One thing to pay attention to is the IP address (and the flag hazelcast.local.publicAddress). On Docker, inside the container it will see a specific IP address but from outside the container it will be a different IP address.