Ok, lets help you with configuration.
There lots of ways to configure several Ignite cluster on one physical
machine.
I created code example with configurations. You can create 2 different
xml-spring configuration file where you will have different 'localhost'
property and different Discovery configurations.
Next example runs 4 servers in one JVM 2 servers make one cluster and 2
another servers make another cluster.
There is no need to use IgniteConfiguration.setGridName() property if you
will run Ignite in different JVMs.
public static void main(String[] args) throws InterruptedException {
try (Ignite ignite1 = Ignition.start(getConfiguration(1));
Ignite ignite2 = Ignition.start(getConfiguration(2));
Ignite ignite3 = Ignition.start(getConfiguration(3));
Ignite ignite4 = Ignition.start(getConfiguration(4))) {
System.out.println("Servers 'testGrid1' and 'testGrid3' make a
cluster " +
"and servers 'testGrid2' and 'testGrid4' make another
one.");
}
}
private static IgniteConfiguration getConfiguration(int gridId) {
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setGridName("testGrid" + gridId);
String locHost = gridId % 2 == 0 ? "127.0.0.1" : "127.0.0.2";
cfg.setLocalHost(locHost);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder finder = new TcpDiscoveryVmIpFinder(true);
Set<String> addrs1 = Collections.singleton(locHost +
":47500..47509");
finder.setAddresses(addrs1);
disco.setIpFinder(finder);
cfg.setDiscoverySpi(disco);
return cfg;
}
--
View this message in context:
http://apache-ignite-users.70518.x6.nabble.com/Best-way-for-isolate-clusters-tp1673p1683.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.