You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by ABDumalagan <ad...@scarletmail.rutgers.edu> on 2020/11/09 17:39:59 UTC

Server created remotely, C# client not able to connect to cluster with IP address

I am starting a cluster through another computer via PuTTY, and I was
wondering how to connect a local node started programmatically with C# to
the cluster? 


Right now, I am running into errors with what I have--

I start an ignite server remotely with the script bash
ignite.shC:\..\\..\config\example-test-connection.xml


*XML Config 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">
        <property name="cacheConfiguration">
            <list>
                
                <bean
class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="default"/>
                    <property name="atomicityMode" value="ATOMIC"/>
                    <property name="backups" value="1"/>
                </bean>
            </list>
        </property>
        
        <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>IpAddress:47500..47509</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>


And the *program *I'm trying to run that creates a client node to connect
with
the cluster:

var cfg = new IgniteClientConfiguration
            {
                Endpoints = new[] { "171.159.66.12" }
            };

            try
            {
                using (IIgniteClient client = Ignition.StartClient(cfg))
                {
                    ICacheClient<int, string> cache = client.GetCache<int,
string>("name");
                    cache.Put(1, "Hello World!");
                    Console.WriteLine("Added a value to the cache!");
                }
            }
            catch(Exception ex)
            {
                Console.WriteLine(ex);
            }


The *error(s) *I'm getting:

System.AggregateException: Failed to establish Ignite thin client
connection, examine inner exceptions for details. (A connection attempt
failed because the connected party did not properly respond after a period
of time, or established connection failed because connected host has failed
to respond. 171.159.66.12:10800)
 ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException
(10060): A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection failed
because connected host has failed to respond. 171.159.66.12:10800
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,
SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
   at
Apache.Ignite.Core.Impl.Client.ClientSocket.Connect(IgniteClientConfiguration
cfg, EndPoint endPoint, ILogger logger)
   at
Apache.Ignite.Core.Impl.Client.ClientSocket..ctor(IgniteClientConfiguration
clientConfiguration, EndPoint endPoint, String host, Nullable`1 version,
Action`1 topVerCallback, Marshaller marshaller)
   at
Apache.Ignite.Core.Impl.Client.ClientFailoverSocket.Connect(SocketEndpoint
endPoint)
   at Apache.Ignite.Core.Impl.Client.ClientFailoverSocket.GetNextSocket()
   --- End of inner exception stack trace ---
   at Apache.Ignite.Core.Impl.Client.ClientFailoverSocket.GetNextSocket()
   at Apache.Ignite.Core.Impl.Client.ClientFailoverSocket.Connect()
   at
Apache.Ignite.Core.Impl.Client.ClientFailoverSocket..ctor(IgniteClientConfiguration
config, Marshaller marsh)
   at
Apache.Ignite.Core.Impl.Client.IgniteClient..ctor(IgniteClientConfiguration
clientConfiguration)
   at Apache.Ignite.Core.Ignition.StartClient(IgniteClientConfiguration
clientConfiguration)
   at IgniteTest.Program.Main(String[] args) in
C:\Users\zk5gdcj\source\repos\Apache_Ignite\Testing\Getting_Started\IgniteTest\IgniteTest\Program.cs:line
85

--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Server created remotely, C# client not able to connect to cluster with IP address

Posted by akorensh <al...@gmail.com>.
Follow the example here:

https://github.com/apache/ignite/blob/master/modules/platforms/dotnet/examples/Apache.Ignite.Examples/ThinClient/ThinClientPutGetExample.cs

if you are running your server on host ABC then  set the cfg as 
            var cfg = new IgniteClientConfiguration("ABC");

see:
https://ignite.apache.org/releases/latest/dotnetdoc/api/Apache.Ignite.Core.Client.IgniteClientConfiguration.html



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Server created remotely, C# client not able to connect to cluster with IP address

Posted by ABDumalagan <ad...@scarletmail.rutgers.edu>.
I see--
If I were to scrap the client/server idea entirely, what changes would I
need to make in order to connect a node created locally and programmatically
with C# with an IP address of DEF to a node created remotely on another
computer with an IP address of ABC?




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Server created remotely, C# client not able to connect to cluster with IP address

Posted by akorensh <al...@gmail.com>.
To see that an IP is reachable from the client node, try using telnet <IP>
<PORT> from the client host.
In your case the port should be 10800 and the IP is the one you are starting
the server from.

The discovery section tells Ignite where to find other nodes needed to form
a cluster. If there is a node on 171.159.66.12 that needs to be in the
cluster then include it in the discovery section.

If the cluster consists of only one server, you can leave the discovery
section blank.

Read through this section:
https://ignite.apache.org/docs/latest/clustering/tcp-ip-discovery




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Server created remotely, C# client not able to connect to cluster with IP address

Posted by ABDumalagan <ad...@scarletmail.rutgers.edu>.
So from your solution, I realized that I think I've been doing this wrong --
I've been starting the server remotely to another computer via PuTTY, and
the IP address is /different / than that of 171.159.66.12 Does that mean I
need to change the XML config file and replace 171.159.66.12 with the IP
address of the computer I'm remotely logging into? Also, how would I make
sure that the remote IP address is reachable from the client node? 



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Server created remotely, C# client not able to connect to cluster with IP address

Posted by akorensh <al...@gmail.com>.
  message:  because connected host has failed to respond. 171.159.66.12:10800

  Ignite would need to be started on 171.159.66.12 in this case.
  The discovery section in tells the server where to find other nodes.

  see : https://ignite.apache.org/docs/latest/clustering/tcp-ip-discovery

  Check that the ip of the server you've started ignite from is
171.159.66.12
  Make sure that this ip is reachable from your client node.
  
  You might need to set the localhost manually.
 
https://ignite.apache.org/docs/latest/clustering/network-configuration#discovery



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Server created remotely, C# client not able to connect to cluster with IP address

Posted by akorensh <al...@gmail.com>.
Hi,
  Looks like you either did not set the discovery section correctly, there
is a network issue
  preventing the C# thin client from connecting, or the server itself has
not started or is not responding.

  message:  because connected host has failed to respond.
171.159.66.12:10800
    Make sure that the clientconnector is up and running at port 10800:
  see:
https://ignite.apache.org/docs/latest/thin-clients/getting-started-with-thin-clients#configuring-thin-client-connector


  Make sure that the Server has started and that you are able to connect to
it via other thin clients.
  Try using sqlline:   https://ignite.apache.org/docs/latest/tools/sqlline


  There is also the possibility that the default timeout is not enough for
your use case:
https://ignite.apache.org/releases/2.9.0/javadoc/org/apache/ignite/configuration/ClientConnectorConfiguration.html#setHandshakeTimeout-long-

  see this example for a simple C# client:
https://github.com/apache/ignite/blob/master/modules/platforms/dotnet/examples/Apache.Ignite.Examples/ThinClient/ThinClientPutGetExample.cs

  doc: https://ignite.apache.org/docs/latest/thin-clients/dotnet-thin-client

Thanks, Alex



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/