Reputation: 21
I have a Hazelcast cluster with 2 instances (running from Docker containers) and a Replicated map which is filled at initialization at the first instance. All works fine and quick. Recently I experienced several times the following situation:
I ended up with a healthy cluster but in reality the cluster contained only partial data which were synced before instance 2 shut down. It took at least one day to observe this bad state and to refresh the data.
This problem happened in multiple environments (test, prod). The reasons why the instances restarted are unknown. My Hazelcast version: 3.7.2. My assumption is the same can happen with 3 or more instances too with less probability.
What are the best practices in a case like this? Thanks!
Upvotes: 2
Views: 2142
Reputation: 110
Cache is only caching data.Try to design your soft with a guess that cache may invalid or lose data all the time.There is also a machanism in hazelcast to load data from db when the data is not hitted.But this is not recommended,because it couples the cache and db.My proposal is that when data is lost, loading from db in your application.
Upvotes: 0
Reputation: 102
if the second instance is restarted before the new instance got the state, you can not expect to recover the whole data.
Upvotes: 2