1
votes

I want to be able to configure a thin client node programmatically in C# that performs SQL queries in cache; additionally, this node connects with a cluster started remotely. However, I am receiving errors in both local VS console and in Linux:

Error on local, VS console

Apache.Ignite.Core.Client.IgniteClientException: 'Client connection has failed. Examine InnerException for details'

InnerException
SocketException: An established connection was aborted by the software in your host machine.

Error on remote, Linux

Unknown connection detected (is some other software connecting to this Ignite port? missing SSL configuration on remote node?) [rmtAddr=/[localHost2]]

I was wondering if the issue lies in either my C# code for the thin client configuration or the XML file I'm passing to start the remote cluster.

C# code

namespace ThinClient
{
    class Program
    {
        static void Main(string[] args)
        {

            var cfg = new IgniteClientConfiguration
            {
                Endpoints = new[] { "[remoteHost]", "[remoteHost]:47500..47509", "[remoteHost]:10800", "[localHost2]",  "[localHost2]:10800"}
            };
            
            using (var client = Ignition.StartClient(cfg))
            {
                var cache = client.GetOrCreateCache<int, Object>("default");
                Console.WriteLine(">>> Client node connected.");
            }
            
        }
    }
}

XML configuration file

<?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">
        <!-- 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">
                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                        <property name="addresses">
                            <list>
                                <!-- In distributed environment, replace with actual host IP address. -->
                                <value>[remoteHost]:47500..47509</value>
                                <value>[localHost1]:47500..47509</value>
                                <value>[localHost2]:47500..47509</value>
                                <value>[localHost2]:10800</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>
1

1 Answers

2
votes

My suspicion is that the issue occurs because you're trying to connect to a discovery port with a thin client from the localHost2. To resolve that just remove discovery endpoints from your thin client configuration.

var cfg = new IgniteClientConfiguration
{
    Endpoints = new[] { "[remoteHost]:10800" }
}; 

It also worth mentioning that your server configuration doesn't seem correct as well. The addresses property should contain discovery addresses of thick server nodes only. It's ok to provide at least one address of a working node (or even 0 if a node is going to be the first). But in general it's recommended to provide all of them, it will make it possible to preserve similar configurations for every server node. In your case this snippet should do the trick:

<property name="ipFinder">
    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
        <property name="addresses">
            <list>
                <value>[remoteHost]:47500..47509</value>
            </list>
        </property>
    </bean>
</property>