我使用Hazelcast作为分布式键值存储。我将存储约。 100k钥匙在里面 为了在整个hazelcast集群节点之间实现更强的数据一致性,我正在利用IMap作为分布式数据结构进行同步备份。
在2个Unix框中运行2个节点的hazelcast集群, 问题:当在任一节点中加载1000条记录的样本数据时,我看不到备份同步发生,即使我已将同步备份清楚地设置为1,从日志和淡水管理中心验证它也是如此。 当我关闭其中一个群集的hazelcast节点时,数据会丢失,即数据未从同步备份中恢复。
任何人都可以建议如果下面提到的任何配置丢失或与同步备份冲突吗?
请在下面找到我用来做我的poc的简短hazelcast.xml配置:
<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>
答案 0 :(得分:0)
启动它们时,您是否看到连接在一起的节点?有时多播发现不起作用(基于网络配置),因此节点构建两个独立的集群。