igniteapacheignite

How does ignite determine the baseline nodes


I am starting two different apache ignite servers on my machine. Both my servers have the same config. The config for the servers is:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd">
 
    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
 
        <property name="discoverySpi">
            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                        <property name="addresses">
                        <list>
                            <value>127.0.0.1:47500..47509</value>
                            <value>127.0.0.1:47500..47509</value>
                        </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
 
        <property name="igniteInstanceName" value="Instance1"/>
 
        <!-- Set consistent ID -->
        <property name="consistentId" value="NodePoswavier1"/>
 
        <!-- TCP Communication SPI configuration -->
        <property name="communicationSpi">
            <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
                <!-- Set the socketWriteTimeout to 5 seconds (5000 milliseconds) -->
                <property name="socketWriteTimeout" value="5000"/>
            </bean>
        </property>
 
        <!-- Data storage configuration -->
        <property name="dataStorageConfiguration">
            <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
                <!-- Default data region configuration -->
                <property name="defaultDataRegionConfiguration">
                    <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
                        <property name="name" value="RegionOne"/>
                        <property name="persistenceEnabled" value="true"/>
                        <property name="metricsEnabled" value="true"/>
                    </bean>
                </property>
            </bean>
        </property>
 
        <!-- Cache configuration -->
        <property name="cacheConfiguration">
            <list>
                <bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="poswavierCache"/>
                    <property name="atomicityMode" value="TRANSACTIONAL"/>
                    <property name="cacheMode" value="REPLICATED"/>
                    <property name="writeSynchronizationMode" value="FULL_ASYNC"/>
                    <property name="backups" value="1"/>
                </bean>
            </list>
        </property>
 
        <!-- Set peer class loading enabled -->
        <property name="peerClassLoadingEnabled" value="true"/>
 
        <!-- Thread pool sizes -->
        <property name="systemThreadPoolSize" value="12"/>
        <property name="publicThreadPoolSize" value="12"/>
        <property name="queryThreadPoolSize" value="12"/>
        <property name="serviceThreadPoolSize" value="12"/>
        <property name="stripedPoolSize" value="12"/>
        <property name="dataStreamerThreadPoolSize" value="12"/>
        <property name="rebalanceThreadPoolSize" value="12"/>
 
    </bean>
</beans>

Now when I start my server 2 first the console says

1 nodes left for auto-activation [NodePoswavier1]

Upon starting Server 1, the cluster automatically transitions to the ACTIVE state. The same behavior applies to the baseline configuration. Is Server 1 getting added to the baseline topology automatically? I want both servers to act as baseline nodes, but to achieve that, I currently have to manually use the control script command. Is there any way to set the cluster state and the baseline nodes without doing it manually?


Solution

  • You can think of the baseline topology as the nodes that are used to store persistent data (it's different for memory-only clusters).

    When you deploy a new cluster, it is inactive. The idea is that you add all your nodes -- two in your case -- and then activate the cluster (control.sh --set-state active). Subsequently, when you restart your cluster, it will automatically activate when those two nodes are present.

    If you want to add or remove nodes, you need to do that manually (control.sh --baseline add/remove).