Hi Prasad, It's required to define a NearCacheConfiguration on a node you'd like to have it one. Use one of the approaches defined in the docs: https://apacheignite.readme.io/docs/near-caches
Near caches can be created directly on *client* nodes by passing NearCacheConfiguration to the Ignite.createNearCache(NearCacheConfiguration) or Ignite.getOrCreateNearCache(NearCacheConfiguration) methods. Use the Ignite.getOrCreateCache(CacheConfiguration, NearCacheConfiguration) method if you need to both start a distributed cache dynamically and create a near cache for it. - Denis On Fri, Apr 19, 2019 at 5:53 AM Prasad Bhalerao < [email protected]> wrote: > Hi, > > Is there any to enable near cache only on client nodes? > > I am using partitioned cache and using colocation to submit the ignite > jobs. But in my code I do few lookups on client node to validate the data. > To improve this lookup performance I want to enable near cache. > > I saw the example on GitHub and in ignite docs. But I am still struggling > to configure near cache on client nodes only. > > This my Ignite configuration on client node. All the cache configurations > are defined only on ignite server nodes. > > Can some please tell me where to include near cache configuration in > following config? > > private IgniteConfiguration getIgniteConfiguration(IgniteSpringBean ignite) { > > String[] hosts = appConfigProperties.getHosts().split(","); > TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(); > ipFinder.setAddresses(Arrays.asList(hosts)); > > TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); > discoSpi.setIpFinder(ipFinder); > > IgniteConfiguration cfg = new IgniteConfiguration(); > cfg.setDiscoverySpi(discoSpi); > cfg.setIgniteInstanceName("springDataNode"); > cfg.setPeerClassLoadingEnabled(false); > cfg.setRebalanceThreadPoolSize(4); > cfg.setClientFailureDetectionTimeout(failureDetectionTimeout); > //cfg.setLifecycleBeans(new IgniteLifeCycleBean()); > cfg.setClientMode(true); > HashMap<String, String> attributeMap = new HashMap<>(); > attributeMap.put(NODE_TYPE,NODE_TYPE_WEB); > cfg.setUserAttributes(attributeMap); > > return cfg; > } > > > > Thanks, > Prasad >
