面临问题 榛子备份 - 同步备份不起作用



我正在使用Hazelcast作为分布式键值存储。我将在其中存储大约 100k 个密钥为了在 hazelcast 群集节点之间实现更强的数据一致性,我正在使用与 IMap 的同步备份作为分布式数据结构。

在 2 个 Unix 框中运行 2 个节点的 hazelcast 集群,问题:在任一节点中加载 1000 条记录的示例数据时,即使我已经明确将同步备份设置为 1,从日志和 hazelcast 管理中心进行了验证,我也没有看到同步发生的备份。当我关闭群集的一个 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>
启动

节点时,您是否看到它们连接在一起?有时,多播发现不起作用(基于网络配置),因此节点构建两个独立的群集。

最新更新