我正在尝试为模型集创建具有持久性的 Ignite 缓存。也就是说,IgniteCache<String, Set<Model>>
。
在本地运行时,一切正常。我可以重新启动应用程序,Ignite 加载它的持久化数据库。
但是当使用 Docker 或 Kubernetes 运行时(带有用于持久性的挂载卷)我无法重新启动应用程序。
我创建了一个 GitHub 存储库以便于测试... https://github.com/jesjobom/ignite-persistence-test/
主要配置:
System.setProperty(IgniteSystemProperties.IGNITE_NO_SHUTDOWN_HOOK, "true");
IgniteConfiguration igniteConfiguration = new IgniteConfiguration();
//Region for persistent (in disk) data
DataRegionConfiguration persistence = new DataRegionConfiguration().setPersistenceEnabled(true)
.setInitialSize(64 * 1024 * 1024)
.setMaxSize(128 * 1024 * 1024).setName(PERSISTENT_REGION_NAME);
DataStorageConfiguration dataStorageConfiguration = new DataStorageConfiguration().setDefaultDataRegionConfiguration(persistence);
//Persistence location config
dataStorageConfiguration.setWalPath(STORAGE_LOCATION + "/wal")
.setWalArchivePath(STORAGE_LOCATION + "/wal-arc")
.setStoragePath(STORAGE_LOCATION + "/store");
igniteConfiguration.setDataStorageConfiguration(dataStorageConfiguration);
ignite = Ignition.getOrStart(igniteConfiguration);
ignite.cluster().active(true);
store = ignite.getOrCreateCache(new CacheConfiguration<String, Set<Model>>()
.setDataRegionName(PERSISTENT_REGION_NAME)
.setCacheMode(CacheMode.REPLICATED)
.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
.setName("store")
.setIndexedTypes(String.class, Set.class)
);
手掌心
相关分类