Сonnect a thin client to all nodes in the cluster

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Сonnect a thin client to all nodes in the cluster

Максим Плотников

Hello!

 

I'm dealing with Apache Ignite at the moment. I create a thin client and specify for it address(host + port), user and password.


I start 3 nodes with the following configuration:

 

<?xml version="1.0" encoding="UTF-8"?>

<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="activeOnStart" value="true"/>

 

                <!-- Set to true to enable distributed class loading for examples, default is false. -->

                <property name="peerClassLoadingEnabled" value="true"/>

 

                <property name="clientConnectorConfiguration">

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

                                   <property name="host" value="127.0.0.1"/>

                                   <property name="port" value="10800"/> <!-- It is default port -->

                                   <property name="portRange" value="30"/>

                               </bean>

               </property>

 

        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->

        <property name="discoverySpi">

            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">

                <property name="ipFinder">

                    <!--

                        Ignite provides several options for automatic discovery that can be used

                        instead os static IP based discovery. For information on all options refer

                        to our documentation: http://apacheignite.readme.io/docs/cluster-config

                    -->

                    <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->

                    <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->

                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">

                        <property name="addresses">

                            <list>

                                <!-- In distributed environment, replace with actual host IP address. -->

                                <value>127.0.0.1:47500..47502</value>

                            </list>

                        </property>

                    </bean>

                </property>

            </bean>

        </property>

    </bean>

</beans>

 

The application successfully connects to the cluster, but if you disconnect the first coordinator node to which the application connected, the application loses its connection to the cluster. The 2 remaining nodes continue to work, but the application can no longer access them.

 

What needs to be done for the application to continue working with the remaining nodes in the cluster?

Reply | Threaded
Open this post in threaded view
|

Re: Сonnect a thin client to all nodes in the cluster

Pavel Tupitsyn
Hello,

Please pass all known server node addresses to ClientConfiguration.setAddresses.

E.g. if everything is on one machine, for 3 servers it'll be


On Mon, Mar 29, 2021 at 3:23 PM Максим Плотников <[hidden email]> wrote:

Hello!

 

I'm dealing with Apache Ignite at the moment. I create a thin client and specify for it address(host + port), user and password.


I start 3 nodes with the following configuration:

 

<?xml version="1.0" encoding="UTF-8"?>

<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="activeOnStart" value="true"/>

 

                <!-- Set to true to enable distributed class loading for examples, default is false. -->

                <property name="peerClassLoadingEnabled" value="true"/>

 

                <property name="clientConnectorConfiguration">

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

                                   <property name="host" value="127.0.0.1"/>

                                   <property name="port" value="10800"/> <!-- It is default port -->

                                   <property name="portRange" value="30"/>

                               </bean>

               </property>

 

        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->

        <property name="discoverySpi">

            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">

                <property name="ipFinder">

                    <!--

                        Ignite provides several options for automatic discovery that can be used

                        instead os static IP based discovery. For information on all options refer

                        to our documentation: http://apacheignite.readme.io/docs/cluster-config

                    -->

                    <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->

                    <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->

                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">

                        <property name="addresses">

                            <list>

                                <!-- In distributed environment, replace with actual host IP address. -->

                                <value>127.0.0.1:47500..47502</value>

                            </list>

                        </property>

                    </bean>

                </property>

            </bean>

        </property>

    </bean>

</beans>

 

The application successfully connects to the cluster, but if you disconnect the first coordinator node to which the application connected, the application loses its connection to the cluster. The 2 remaining nodes continue to work, but the application can no longer access them.

 

What needs to be done for the application to continue working with the remaining nodes in the cluster?