I am running two Apache Ignite instances (version 2.2.0) in my single host
pc, and they discover each other with no issues. What I want to do now, is
to simply create an IgniteCache in this existing "pseudo cluster",
preferably without starting a new instance to do so. This is the code I have
right now:
public class Create_Ignite_Cache {
public static void main(String[] args){
TcpDiscoverySpi spi = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipFinder=new TcpDiscoveryMulticastIpFinder();
List<String> adresses=new ArrayList<String>();
adresses.add("127.0.0.1");
ipFinder.setAddresses(adresses);
spi.setIpFinder(ipFinder);
IgniteConfiguration cfg=new IgniteConfiguration()
.setDiscoverySpi(spi).setClientMode(true);
CacheConfiguration cache_conf=new
CacheConfiguration<String,String>().setCacheMode(CacheMode.PARTITIONED).setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL).setBackups(1).
setGroupName("Test_group").setIndexedTypes(String.class,String.class).setName("Test_Cache");
Ignite ignite=Ignition.getOrStart(cfg);
ignite.getOrCreateCache(cache_conf);
System.out.print("[INFO] CACHE CREATED");
ignite.close();
}
}
When I run this code, an Ignite client instance is created, tries to create
a cache, and then closes the client instance. If I check the logs from the
Ignite server instance, it detects the client instance when it is created:
[10:36:57] Topology snapshot [ver=1, servers=1, clients=0, CPUs=12,
heap=1.0GB]
[10:41:07] Topology snapshot [ver=2, servers=1, clients=1, CPUs=12,
heap=4.6GB]
[10:41:07] Topology snapshot [ver=3, servers=1, clients=0, CPUs=12,
heap=1.0GB]
However, when I run the ignitevisor to check the cache list, it doesn't have
any cache present:
visor> cache
(wrn) <visor>: No caches found.
My questions are: What am I doing wrong by using this approach? Is there a
way to create a cache in an existing cluster without having to create a
client instance to do so? With a JDBC connection for example?
Thank you very much.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/