Java Apache Ignite在节点崩溃时丢失数据?
我使用的是ApacheIgnite2.4.0,官方示例中有我自己的小改动(下面的代码)。我测试了以下场景:Java Apache Ignite在节点崩溃时丢失数据?,java,ignite,Java,Ignite,我使用的是ApacheIgnite2.4.0,官方示例中有我自己的小改动(下面的代码)。我测试了以下场景: 启动了3个实例(在本地笔记本电脑上) 启动了一个客户端并创建了一个带有1个备份的缓存 public static void main(String[] args) throws IgniteException { Ignition.setClientMode(true); try (Ignite ignite = Ignition.start("examples/config/examp
- 启动了3个实例(在本地笔记本电脑上)
- 启动了一个客户端并创建了一个带有1个备份的缓存
然后停止一个节点,再次执行putGet方法(这次只是读取部分)。结果是:public static void main(String[] args) throws IgniteException { Ignition.setClientMode(true); try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { CacheConfiguration cfg = new CacheConfiguration(); cfg.setName(CACHE_NAME) .setAtomicityMode(CacheAtomicityMode.ATOMIC) .setCacheMode(CacheMode.PARTITIONED) .setBackups(1) .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC) .setReadFromBackup(true); try (IgniteCache<Integer, String> cache = ignite.getOrCreateCache(cfg)) { putGet(cache); } } }
>>> Cache put-get example started. >>> Stored values in cache. Cache size:48 [01:38:25] Ignite node stopped OK [uptime=00:00:00.406]
集群是否应该能够从其他两个节点上的备份中恢复驻留在崩溃节点上的数据?更确切地说,备份的行为是什么?是否需要打开持久性模式?如果我将备份设置为2,那么数据将在一个节点崩溃后恢复。有人能解释一下原因吗?我知道,如果每个分区有1个备份,我应该在节点之间进行数据拆分,如下所示:N1=[A primary,B backup],N2=[B primary,C backup],N3=[A primary,C backup],这样,它应该能够恢复。Hi@RemusS,我无法重现您描述的行为。您确定不使用Ignite本机持久性吗?是否可以共享所有节点的日志文件?@sk050-未配置本机持久性。现在我没有日志了;我将重做测试并尝试共享。当使用3个节点且备份=1时,您是否获得了完整的数据?是的,我获得了完整的数据。该配置和测试场景中没有数据丢失。>>> Cache put-get example started. >>> Stored values in cache. Cache size:100 [01:35:21] Ignite node stopped OK [uptime=00:00:00.744]
>>> Cache put-get example started. >>> Stored values in cache. Cache size:48 [01:38:25] Ignite node stopped OK [uptime=00:00:00.406]