0
votes

I am using Hazelcast as a distributed key-value store. I will be storing approx. 100k keys in it In order for stronger data consistency across hazelcast cluster nodes I am making use of sync backup with IMap as distributed data structure.

Running hazelcast cluster of 2 nodes in 2 Unix boxes, Problem: when loading sample data of 1000 records in either of the nodes, I do not see backup happening synchronously, even though I have clearly set the sync backup as 1, verified it from logs, and hazelcast management center as well. When I shutdown one of the hazelcast node of cluster, data gets lost i.e. data didn’t got recovered from sync backup.

Can anyone please suggest if any configuration as mentioned below is missing or conflicting with sync backup?

Please find below brief hazelcast.xml configuration I am using to do my poc:

<group>
    <name>abc</name>
    <password>xyz</password>
</group>    

<map name="default">
    <in-memory-format>BINARY</in-memory-format>
    <backup-count>1</backup-count>
    <async-backup-count>0</async-backup-count>
    <read-backup-data>false</read-backup-data>
    <time-to-live-seconds>0</time-to-live-seconds>
    <max-idle-seconds>86400</max-idle-seconds>
    <eviction-policy>LRU</eviction-policy>
    <max-size policy="used_heap_size">300</max-size>
    <eviction-percentage>25</eviction-percentage>
    <min-eviction-check-millis>100</min-eviction-check-millis>
    <merge-policy>com.hazelcast.map.merge.PutIfAbsentMapMergePolicy</merge-policy>
    <statistics-enabled>true</statistics-enabled>
    <map-store enabled="true" initial-mode="LAZY">
        <!--<factory-class-name>com.mypackage.FileSystemMapStoreFactory</factory-class-name>-->
        <class-name>com.java.poc.TestMapStore</class-name>
        <write-delay-seconds>0</write-delay-seconds>
        <!--<write-batch-size>1000</write-batch-size>-->
        <write-coalescing>false</write-coalescing>
    </map-store>
</map>

<serialization>
    <portable-version>0</portable-version>
    <use-native-byte-order>true</use-native-byte-order><!-- Set to true to use native byte order for the underlying platform -->
    <byte-order>BIG_ENDIAN</byte-order>
    <enable-compression>false</enable-compression><!-- Enables compression if default Java serialization is used -->
    <enable-shared-object>false</enable-shared-object><!-- Enables shared object if default Java serialization is used -->
    <allow-unsafe>true</allow-unsafe><!-- Set to true to allow unsafe to be used -->
    <check-class-def-errors>true</check-class-def-errors>
    <data-serializable-factories><!-- The DataSerializableFactory class to be registered -->
        <data-serializable-factory factory-id="1">com.java.poc.DataSerializableFactoryImpl</data-serializable-factory>
    </data-serializable-factories>
</serialization>
1

1 Answers

0
votes

Do you see the nodes connecting together when you start them up? Sometimes multicast discovery doesn't work (based on the network configuration) and therefore the nodes build two independent clusters.