ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Artem Shutak <ashu...@gridgain.com>
Subject Re: Best way for isolate clusters
Date Fri, 23 Oct 2015 12:25:31 GMT
Ok, lets help you with configuration.

There lots of ways to configure several Ignite cluster on one physical

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

    private static IgniteConfiguration getConfiguration(int gridId) {
        IgniteConfiguration cfg = new IgniteConfiguration();

        cfg.setGridName("testGrid" + gridId);

        String locHost = gridId % 2 == 0 ? "" : "";


        TcpDiscoverySpi disco = new TcpDiscoverySpi();

        TcpDiscoveryVmIpFinder finder = new TcpDiscoveryVmIpFinder(true);

        Set<String> addrs1 = Collections.singleton(locHost +




        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.

View raw message