Esenbek Kydyr uulu
Esenbek Kydyr uulu

Reputation: 1623

How to make hazelcast lose data when any node is down?

I have a shared Set in Hazelcast cluster. 2 nodes of Hazelcast add items to that set. I need the items added by node1 be deleted from that set when node1 is down. I want a set that stores items added only by active(running) hazelcast nodes. How can I achieve this?

I've tried the following:

Config config = new Config();
config.getSetConfig( "myset" ).setBackupCount( 0 ).setAsyncBackupCount( 0 );

HazelcastInstance hazelcast = com.hazelcast.core.Hazelcast.newHazelcastInstance( config );

but it keeps the items added by node1 on node2's memory when node1 is down.

Upvotes: 0

Views: 283

Answers (1)

noctarius
noctarius

Reputation: 6094

I would keep the data in separate maps like map_node1 and map_node2 and when one of the members goes down, you can use a MemberListener on the other node to clean the corresponding map.

Upvotes: 1

Related Questions