I am having some issues creating cache K,V pairs on my remote Ignite cluster. My Ignite nodes are built on a Maven project in Java8, clustered via multicast configuration, with partitioned cache. The problem faced here is that ignite can only successfully create and retrieve cache via SqlFieldQuery or NoSQL when there are exactly 1 node in the cluster. When I scale it to more than 1(in this case 2), I face this error thrown by the remote server.
Caused by: org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException: Failed to map keys for cache (all partition nodes left the grid) [topVer=AffinityTopologyVersion [topVer=5, minorTopVer=3], cache=Transactions]
at org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture.serverNotFoundError(GridPartitionedSingleGetFuture.java:711) ~[ignite-core-2.6.0.jar:2.6.0]
at org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture.mapKeyToNode(GridPartitionedSingleGetFuture.java:332) ~[ignite-core-2.6.0.jar:2.6.0]
at org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture.map(GridPartitionedSingleGetFuture.java:216) ~[ignite-core-2.6.0.jar:2.6.0]
at org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture.init(GridPartitionedSingleGetFuture.java:208) ~[ignite-core-2.6.0.jar:2.6.0]
at org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache.getAsync(GridDhtColocatedCache.java:246) ~[ignite-core-2.6.0.jar:2.6.0]
at org.apache.ignite.internal.processors.cache.GridCacheAdapter.get0(GridCacheAdapter.java:4556) ~[ignite-core-2.6.0.jar:2.6.0]
at org.apache.ignite.internal.processors.cache.GridCacheAdapter.get(GridCacheAdapter.java:4537) ~[ignite-core-2.6.0.jar:2.6.0]
at org.apache.ignite.internal.processors.cache.GridCacheAdapter.get(GridCacheAdapter.java:1350) ~[ignite-core-2.6.0.jar:2.6.0]
at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.get(IgniteCacheProxyImpl.java:907) ~[ignite-core-2.6.0.jar:2.6.0]
This is my server setup:
public class App
{
protected static IgniteConfiguration config;
protected static String igniteID = UUID.randomUUID().toString();
public static void main( String[] args )
{
System.out.println( "Starting instance of Ignite..." );
config = new IgniteConfiguration();
config.setIgniteInstanceName("ignite-node-"+igniteID);
config.setClientMode(false);
setupDiscoveryConfig();
setupDataConfig();
//cacheConfig();
config.setPeerClassLoadingEnabled(false);
config.setDeploymentMode(DeploymentMode.CONTINUOUS);
config.setPeerClassLoadingMissedResourcesCacheSize(0);
config.setFailureDetectionTimeout(10000);
config.setClientFailureDetectionTimeout(10000);
config.setNetworkTimeout(10000);
Ignite ignite = Ignition.start(config);
loadAndRemove(ignite);
}
private static void loadAndRemove(Ignite ignite) {
ignite.cluster().active();
IgniteCache<String, TransactionRecord> cache = ignite.getOrCreateCache("Transactions");
}
private static void cacheConfig(){
CacheConfiguration cacheConfig = new CacheConfiguration("Transactions");
cacheConfig.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
cacheConfig.setCacheMode(CacheMode.PARTITIONED);
config.setCacheConfiguration(cacheConfig);
}
private static void setupDataConfig(){
DataStorageConfiguration storageConfiguration = new DataStorageConfiguration();
storageConfiguration.getDefaultDataRegionConfiguration()
.setPersistenceEnabled(true);
config.setDataStorageConfiguration(storageConfiguration);
}
private static void setupDiscoveryConfig(){
TcpDiscoverySpi spi = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryMulticastIpFinder();
((TcpDiscoveryMulticastIpFinder) ipFinder).setMulticastGroup("228.10.10.157");
ipFinder.setAddresses(Arrays.asList("127.0.0.1"));
spi.setIpFinder(ipFinder);
config.setDiscoverySpi(spi);
}
}
Client configs as shown below:
@Bean
public Ignite igniteInstance(){
IgniteConfiguration config = new IgniteConfiguration();
config.setIgniteInstanceName("cluster-client");
config.setClientMode(true);
config.setPeerClassLoadingEnabled(false);
config.setDeploymentMode(DeploymentMode.CONTINUOUS);
config.setPeerClassLoadingMissedResourcesCacheSize(0);
config.setFailureDetectionTimeout(10000);
config.setClientFailureDetectionTimeout(10000);
config.setNetworkTimeout(10000);
TcpDiscoverySpi spi = new TcpDiscoverySpi();
TcpDiscoveryMulticastIpFinder ipFinder = new TcpDiscoveryMulticastIpFinder();
ipFinder.setMulticastGroup("228.10.10.157");
ipFinder.setAddresses(Arrays.asList("127.0.0.1"));
spi.setIpFinder(ipFinder);
config.setDiscoverySpi(spi);
return Ignition.getOrStart(config);
}
Data insertion is using the simple cache.put command. Appreciate if anyone can help me out on this.