0

我使用 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>
4

1 回答 1

0

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

于 2016-03-15T11:45:03.480 回答