GridGain Developers Hub

Multi-Cluster Support

There can be a situation where you have multiple clusters and you want to monitor or manage them in parallel from a single Web Console instance deployed on your system environment.

To achieve this, you need to start an instance of Web Agent for every cluster and connect them to your deployment of Web Console, as shown in the picture below.

multi cluster support

The most straightforward way to enable the multi-cluster support is to start the agent on the same machine/hardware or in the same network where one of the nodes of the cluster is running.

Two Clusters on Single Host

This section describes how to start several clusters on a single host and connect them to Web Console. As an example, we will configure and start two clusters and two Web Agents.

Here is a sample configuration for the first cluster:

<bean class="org.apache.ignite.configuration.IgniteConfiguration">

    <!--
    Explicitly configure TCP discovery SPI to provide list of
    initial nodes from the first cluster.
    -->
    <property name="discoverySpi">
        <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
            <!-- Initial local port to listen to. -->
            <property name="localPort" value="48500"/>

            <!-- Changing local port range. This is an optional action. -->
            <property name="localPortRange" value="20"/>

            <!-- Setting up IP finder for this cluster -->
            <property name="ipFinder">
                <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                    <property name="addresses">
                        <list>
                            <!--
                            Addresses and port range of the nodes from the first cluster.
                            127.0.0.1 can be replaced with actual IP addresses or
                            host names. Port range is optional.
                            -->
                            <value>127.0.0.1:48500..48520</value>
                        </list>
                    </property>
                </bean>
            </property>
        </bean>
    </property>

    <!--
    Explicitly configure TCP communication SPI changing local
    port number for the nodes from the first cluster.
    -->
    <property name="communicationSpi">
        <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
            <property name="localPort" value="48100"/>
        </bean>
    </property>
</bean>

And here is the configuration for the second cluster:

<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
    <!--
    Explicitly configure TCP discovery SPI to provide list of initial
    nodes from the second cluster.
    -->
    <property name="discoverySpi">
        <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
            <!-- Initial local port to listen to. -->
            <property name="localPort" value="49500"/>

            <!-- Changing local port range. This is an optional action. -->
            <property name="localPortRange" value="20"/>

            <!-- Setting up IP finder for this cluster -->
            <property name="ipFinder">
                <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                    <property name="addresses">
                        <list>
                            <!--
                            Addresses and port range of the nodes from the second cluster.
                            127.0.0.1 can be replaced with actual IP addresses or
                            host names. Port range is optional.
                            -->
                            <value>127.0.0.1:49500..49520</value>
                        </list>
                    </property>
                </bean>
            </property>
        </bean>
    </property>

    <!--
    Explicitly configure TCP communication SPI changing local port number
    for the nodes from the second cluster.
    -->
    <property name="communicationSpi">
        <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
            <property name="localPort" value="49100"/>
        </bean>
    </property>
</bean>

Assuming that the clusters' configurations are stored in ${IGNITE_HOME}/config folder, we can start the first cluster’s node with this command:

ignite.sh -v -J-DIGNITE_JETTY_PORT=8080 config/first-cluster.xml

A node for the second cluster can be started this way:

ignite.sh -v -J-DIGNITE_JETTY_PORT=9090 config/second-cluster.xml

You must set different values for the JETTY_PORT parameter because we are starting the nodes on a single host.

Finally, let’s start Web Agent that will connect to the first cluster’s node:

gridgain-web-console-agent.sh --node-uri http://localhost:8080

and Web Agent that will connect to the second cluster:

gridgain-web-console-agent.sh --node-uri http://localhost:9090

Open Web Console in your browser, and you will see that the console can work with two clusters.

Two Clusters on Different Hosts

When two clusters are deployed in different networks, there is no need to configure TcpDiscoverySpi, TcpCommunicationSpi or JETTY_PORT, as shown in the previous section.

All you need to do is to connect two instances of Web Agent to each cluster.

Connect the first Web Agent to a node in the first cluster:

gridgain-web-console-agent.sh --node-uri http://host1:8080

And repeat the same for the second cluster:

gridgain-web-console-agent.sh --node-uri http://host2:8080