Hi Prasad, // Please send different questions separately – this way it’s easier to answer and to search for existing answers
> Also, I am loading the cache from oracle table using loadCache method. If the > persistence is enabled and if the data is already persisted, I want to make > sure that the cache is loaded from persisted data instead of loading it from > oracle table using loadCache. Can someone please advise how this can be > achieved? Ignite doesn’t support using 3rd party DBs and native persistence with the same cache. If you need to use both, I’d suggest to create two caches, one backed by Oracle and one with enabled Ignite persistence, and alternate between them in your application code. Thanks, Stan From: Prasad Bhalerao Sent: 20 февраля 2018 г. 15:24 To: [email protected] Subject: Getting Invalid state exception when Persistance is enabled. Hi, I am starting ignite node in server mode in intellij. I am starting only one instance of it. I am using IgniteSpringBean to set configuration and start the node as shown below. But when I enable persistence, I get following exception. Caused by: java.lang.IllegalStateException: Ignite is in invalid state to perform this operation. It either not started yet or has already being or have stopped [ignite=null, cfg=null] As per the doc, IgniteSpringBean is responsible for starting the ignite. So how to set node to active state in case this case? Also, I am loading the cache from oracle table using loadCache method. If the persistence is enabled and if the data is already persisted, I want to make sure that the cache is loaded from persisted data instead of loading it from oracle table using loadCache. Can someone please advise how this can be achieved? Code to config ignite and cache: @Bean public IgniteSpringBean igniteInstance() { IgniteSpringBean ignite = new IgniteSpringBean(); ignite.active(true); ignite.setConfiguration(getIgniteConfiguration()); return ignite; } private IgniteConfiguration getIgniteConfiguration() { String HOST = "127.0.0.1:47500..47509"; TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(); ipFinder.setAddresses(Collections.singletonList(HOST)); TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); discoSpi.setIpFinder(ipFinder); IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setDiscoverySpi(discoSpi); cfg.setIgniteInstanceName("springDataNode"); cfg.setPeerClassLoadingEnabled(false); cfg.setRebalanceThreadPoolSize(4); DataStorageConfiguration storageCfg = new DataStorageConfiguration(); storageCfg.getDefaultDataRegionConfiguration().setPersistenceEnabled(true); cfg.setDataStorageConfiguration(storageCfg); CacheConfiguration<IPRangeDataKey, IPV4RangeData> ipv4RangeCacheCfg = new CacheConfiguration<>("IPV4RangeCache"); ipv4RangeCacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); ipv4RangeCacheCfg.setWriteThrough(false); ipv4RangeCacheCfg.setReadThrough(false); ipv4RangeCacheCfg.setRebalanceMode(CacheRebalanceMode.ASYNC); ipv4RangeCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); ipv4RangeCacheCfg.setBackups(1); Factory<IPV4RangeCacheDataLoader> storeFactory = FactoryBuilder.factoryOf(IPV4RangeCacheDataLoader.class); ipv4RangeCacheCfg.setCacheStoreFactory(storeFactory); cfg.setCacheConfiguration(ipv4RangeCacheCfg); return cfg; } Thanks, Prasad
