0
votes

I have spring boot application. I am using embedded embedded Hazelcast in this web app. I use a lot of data available in cache. Initially I used to run only one docker containers. Now, to scale the response, I started 3 docker containers of same image. Every docker containers now have their embedded Hazelcast running. So, once I hit for refresh of the cache, the containers who serves the request, will only have the latest data and other two will not have the latest data unless and until refresh request is not served.

Problem:

Due to all three containers are running of their own along with Hazelcast, Hazelcast of all three containers are not in sync. I need to sync all the Hazelcast running inside the containers, so that a single refresh should refresh the cache data on all three containers Hazelcast.

How to do it?

Edit : I am using docker swarm. In one VM, I have two containers and on another, I have one container of same image. I found that through <public-address-ip> it could be achieved, but did not tried so far.

1

1 Answers

2
votes

You need to make your Hazelcast instances form one cluster. How to do it depends on the environment you're running in. Check Hazelcast Reference Manual Discovery Mechanisms for details.

If you run in Docker Swarm, you should use Docker Swarm Discovery SPI Plugin.