Thick client/thin client difference and how to get thin client port

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

Thick client/thin client difference and how to get thin client port

Hi,

I am seeing that a thin client cannot reconnect (on the same port) after a
server shutdown.  I have 1 backup enabled and load some data in the cache on
startup.  Replication procedure is:
1) Start server 1
2) Try thin client --> it retrieves data
3) Start server 2
4) Kill server 1 (Server 2 output below)
5) Try thin client --> fails with :
org.apache.ignite.client.ClientConnectionException: Ignite cluster is
unavailable
        at
org.apache.ignite.internal.client.thin.TcpClientChannel.<init>(TcpClientChannel.java:114)
~[ignite-core-2.7.5.jar:2.7.5]
6) Try thick client --> works fine

Almost certainly this is due to the connection port for the thin client (as
server 2 thin client listener cannot start on the same port).  But how do I
discover which port is opened on server 2 for thin clients?

Thanks,
Rick

Server 2
[08:51:40] Topology snapshot [ver=2, locNode=3da900bd, servers=2, clients=0,
state=ACTIVE, CPUs=4, offheap=9.3GB, heap=7.9GB]
StartIgnite-->Ignite Initialization.  Got cache Tables from Ignite.
[08:51:56] Topology snapshot [ver=3, locNode=3da900bd, servers=1, clients=0,
state=ACTIVE, CPUs=4, offheap=4.6GB, heap=4.0GB]
[08:51:56] Coordinator changed [prev=TcpDiscoveryNode
[id=ae5f19f3-2cfe-477b-b16d-4d12fb95aaad, addrs=[10.0.75.1, 127.0.0.1,
172.27.252.225, 192.168.1.123, 192.168.32.1],
sockAddrs=[/172.27.252.225:47500, /10.0.75.1:47500, /127.0.0.1:47500,
/192.168.32.1:47500, L2SG9M32.europe.temenosgroup.com/192.168.1.123:47500],
discPort=47500, order=1, intOrder=1, lastExchangeTime=1561704688821,
loc=false, ver=2.7.5#20190603-sha1:be4f2a15, isClient=false],
cur=TcpDiscoveryNode [id=3da900bd-79b3-4b49-a0d4-4b6cbe134b54,
addrs=[10.0.75.1, 10.30.200.76, 127.0.0.1, 172.27.252.225, 192.168.1.123,
192.168.32.1],
sockAddrs=[L2SG9M32.europe.temenosgroup.com/192.168.1.123:47501,
L2SG9M32.mshome.net/172.27.252.225:47501, /10.30.200.76:47501,
/127.0.0.1:47501, /192.168.32.1:47501, /10.0.75.1:47501], discPort=47501,
order=2, intOrder=2, lastExchangeTime=1561704716259, loc=true,
ver=2.7.5#20190603-sha1:be4f2a15, isClient=false]]



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Igor Sapego-1 Igor Sapego-1
Reply | Threaded
Open this post in threaded view
|

Re: Thick client/thin client difference and how to get thin client port

Well, it seems like you start two nodes on the same host, and as first
node occupies default thin client port (10800) the second node takes
the next one (10801).

I believe you use 127.0.0.1 or something like this for your thin client
host lists which effectively means 127.0.0.1:10800. So, your thin client
just is not aware about the second node which is using 10801 port once
the first node is dead. To fix it you can write a second address in your
client configuration: 127.0.0.1:10800,127.0.0.1:10801 or simply
127.0.0.1:10800..10801.

Hope, it helps.

Best Regards,
Igor


On Fri, Jun 28, 2019 at 10:14 AM rick_tem <[hidden email]> wrote:
Hi,

I am seeing that a thin client cannot reconnect (on the same port) after a
server shutdown.  I have 1 backup enabled and load some data in the cache on
startup.  Replication procedure is:
1) Start server 1
2) Try thin client --> it retrieves data
3) Start server 2
4) Kill server 1 (Server 2 output below)
5) Try thin client --> fails with :
org.apache.ignite.client.ClientConnectionException: Ignite cluster is
unavailable
        at
org.apache.ignite.internal.client.thin.TcpClientChannel.<init>(TcpClientChannel.java:114)
~[ignite-core-2.7.5.jar:2.7.5]
6) Try thick client --> works fine

Almost certainly this is due to the connection port for the thin client (as
server 2 thin client listener cannot start on the same port).  But how do I
discover which port is opened on server 2 for thin clients?

Thanks,
Rick

Server 2
[08:51:40] Topology snapshot [ver=2, locNode=3da900bd, servers=2, clients=0,
state=ACTIVE, CPUs=4, offheap=9.3GB, heap=7.9GB]
StartIgnite-->Ignite Initialization.  Got cache Tables from Ignite.
[08:51:56] Topology snapshot [ver=3, locNode=3da900bd, servers=1, clients=0,
state=ACTIVE, CPUs=4, offheap=4.6GB, heap=4.0GB]
[08:51:56] Coordinator changed [prev=TcpDiscoveryNode
[id=ae5f19f3-2cfe-477b-b16d-4d12fb95aaad, addrs=[10.0.75.1, 127.0.0.1,
172.27.252.225, 192.168.1.123, 192.168.32.1],
sockAddrs=[/172.27.252.225:47500, /10.0.75.1:47500, /127.0.0.1:47500,
/192.168.32.1:47500, L2SG9M32.europe.temenosgroup.com/192.168.1.123:47500],
discPort=47500, order=1, intOrder=1, lastExchangeTime=1561704688821,
loc=false, ver=2.7.5#20190603-sha1:be4f2a15, isClient=false],
cur=TcpDiscoveryNode [id=3da900bd-79b3-4b49-a0d4-4b6cbe134b54,
addrs=[10.0.75.1, 10.30.200.76, 127.0.0.1, 172.27.252.225, 192.168.1.123,
192.168.32.1],
sockAddrs=[L2SG9M32.europe.temenosgroup.com/192.168.1.123:47501,
L2SG9M32.mshome.net/172.27.252.225:47501, /10.30.200.76:47501,
/127.0.0.1:47501, /192.168.32.1:47501, /10.0.75.1:47501], discPort=47501,
order=2, intOrder=2, lastExchangeTime=1561704716259, loc=true,
ver=2.7.5#20190603-sha1:be4f2a15, isClient=false]]



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
rick_tem rick_tem
Reply | Threaded
Open this post in threaded view
|

Re: Thick client/thin client difference and how to get thin client port

Thanks for your response.  I tried 10801 and it failed.  My question is how
do I find out which port it is using?

Thanks,
Rick



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Alex Plehanov Alex Plehanov
Reply | Threaded
Open this post in threaded view
|

Re: Thick client/thin client difference and how to get thin client port

Hello, Rick

There should be a message in the server log:
"Client connector processor has started on TCP port xxxxx" with "INFO" level.

пн, 1 июл. 2019 г. в 10:26, rick_tem <[hidden email]>:
Thanks for your response.  I tried 10801 and it failed.  My question is how
do I find out which port it is using?

Thanks,
Rick



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
shaneduan shaneduan
Reply | Threaded
Open this post in threaded view
|

Re: Thick client/thin client difference and how to get thin client port

I am having similar problem: I am testing with a one-node-cluster. After restart the Ignite cluster(server), Java thin client is not reconnecting. There is no port change on server for my case since I defined client port in the Ignite configuration:

org.apache.ignite.client.ClientConnectionException: Ignite cluster is unavailable
at org.apache.ignite.internal.client.thin.TcpClientChannel.read(TcpClientChannel.java:333)
at org.apache.ignite.internal.client.thin.TcpClientChannel.receive(TcpClientChannel.java:154)
at org.apache.ignite.internal.client.thin.ReliableChannel.service(ReliableChannel.java:126)
at org.apache.ignite.internal.client.thin.TcpClientCache.get(TcpClientCache.java:82)
at com.esri.arcgis.datastore.model.cachestore.BinaryTest.main(BinaryTest.java:69)

import org.apache.ignite.IgniteBinary;
import org.apache.ignite.Ignition;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.client.ClientCache;
import org.apache.ignite.client.IgniteClient;
import org.apache.ignite.configuration.ClientConfiguration;

public class BinaryTest {

public static void main(String[] args) {

IgniteClient igniteClient = null;

try{

// Prepare a Ignite thin client
String hostName = args[0];
Integer portNumber = Integer.parseInt(args[1]);
String userName = args[2];
String password = args[3];

ClientConfiguration cfg = new ClientConfiguration().setAddresses(hostName + ":" + portNumber);
cfg.setUserName(userName);
cfg.setUserPassword(password);

igniteClient = Ignition.startClient(cfg);

// Get IgniteBinary object using the ignite thin client.
IgniteBinary binary = igniteClient.binary();

// Build two test binary object.
// Note: we are defining the attributes for the binary object on the fly.
BinaryObject val1 = binary.builder("person")
.setField("id", 1, int.class)
.setField("name", "Tom J", String.class)
.build();
BinaryObject val2 = binary.builder("person")
.setField("id", 2, int.class)
.setField("name", "Jeffson L", String.class)
.build();

// Create a cache, keep it as binary.
ClientCache<Integer, BinaryObject> cache = igniteClient.getOrCreateCache("persons").withKeepBinary();

// Store the testing objects.
cache.put(1, val1);
cache.put(2, val2);


////////////////////////////////////////////
// Please restart Ignite server here.
////////////////////////////////////////////

// Get the objects.
BinaryObject cachedVal1 = cache.get(1);
System.out.println("Person1");
System.out.println("\tID = " + cachedVal1.field("id"));
System.out.println("\tName = " + cachedVal1.field("name"));

BinaryObject cachedVal2 = cache.get(2);
System.out.println("Person2");
System.out.println("\tID = " + cachedVal2.field("id"));
System.out.println("\tName = " + cachedVal2.field("name"));

// Destroy the cache.
System.out.print("Dropped caches...");
igniteClient.destroyCache("persons");

} catch (Exception e) {
e.printStackTrace();
} finally {
if (igniteClient != null) {
try {
igniteClient.close();
} catch (Exception ignore) {
}
}
}
}

}

On Mon, Jul 1, 2019 at 5:38 AM Alex Plehanov <[hidden email]> wrote:
Hello, Rick

There should be a message in the server log:
"Client connector processor has started on TCP port xxxxx" with "INFO" level.

пн, 1 июл. 2019 г. в 10:26, rick_tem <[hidden email]>:
Thanks for your response.  I tried 10801 and it failed.  My question is how
do I find out which port it is using?

Thanks,
Rick



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Alex Plehanov Alex Plehanov
Reply | Threaded
Open this post in threaded view
|

Re: Thick client/thin client difference and how to get thin client port

Hello,

There was a bug [1] with one node thin client configuration, which is fixed now but was not released yet.
You can try to add one more server address (the same address) as a workaround. For example:
ClientConfiguration cfg = new ClientConfiguration().setAddresses(hostName + ":" + portNumber, hostName + ":" + portNumber);


вт, 2 июл. 2019 г. в 20:36, Shane Duan <[hidden email]>:
I am having similar problem: I am testing with a one-node-cluster. After restart the Ignite cluster(server), Java thin client is not reconnecting. There is no port change on server for my case since I defined client port in the Ignite configuration:

org.apache.ignite.client.ClientConnectionException: Ignite cluster is unavailable
at org.apache.ignite.internal.client.thin.TcpClientChannel.read(TcpClientChannel.java:333)
at org.apache.ignite.internal.client.thin.TcpClientChannel.receive(TcpClientChannel.java:154)
at org.apache.ignite.internal.client.thin.ReliableChannel.service(ReliableChannel.java:126)
at org.apache.ignite.internal.client.thin.TcpClientCache.get(TcpClientCache.java:82)
at com.esri.arcgis.datastore.model.cachestore.BinaryTest.main(BinaryTest.java:69)

import org.apache.ignite.IgniteBinary;
import org.apache.ignite.Ignition;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.client.ClientCache;
import org.apache.ignite.client.IgniteClient;
import org.apache.ignite.configuration.ClientConfiguration;

public class BinaryTest {

public static void main(String[] args) {

IgniteClient igniteClient = null;

try{

// Prepare a Ignite thin client
String hostName = args[0];
Integer portNumber = Integer.parseInt(args[1]);
String userName = args[2];
String password = args[3];

ClientConfiguration cfg = new ClientConfiguration().setAddresses(hostName + ":" + portNumber);
cfg.setUserName(userName);
cfg.setUserPassword(password);

igniteClient = Ignition.startClient(cfg);

// Get IgniteBinary object using the ignite thin client.
IgniteBinary binary = igniteClient.binary();

// Build two test binary object.
// Note: we are defining the attributes for the binary object on the fly.
BinaryObject val1 = binary.builder("person")
.setField("id", 1, int.class)
.setField("name", "Tom J", String.class)
.build();
BinaryObject val2 = binary.builder("person")
.setField("id", 2, int.class)
.setField("name", "Jeffson L", String.class)
.build();

// Create a cache, keep it as binary.
ClientCache<Integer, BinaryObject> cache = igniteClient.getOrCreateCache("persons").withKeepBinary();

// Store the testing objects.
cache.put(1, val1);
cache.put(2, val2);


////////////////////////////////////////////
// Please restart Ignite server here.
////////////////////////////////////////////

// Get the objects.
BinaryObject cachedVal1 = cache.get(1);
System.out.println("Person1");
System.out.println("\tID = " + cachedVal1.field("id"));
System.out.println("\tName = " + cachedVal1.field("name"));

BinaryObject cachedVal2 = cache.get(2);
System.out.println("Person2");
System.out.println("\tID = " + cachedVal2.field("id"));
System.out.println("\tName = " + cachedVal2.field("name"));

// Destroy the cache.
System.out.print("Dropped caches...");
igniteClient.destroyCache("persons");

} catch (Exception e) {
e.printStackTrace();
} finally {
if (igniteClient != null) {
try {
igniteClient.close();
} catch (Exception ignore) {
}
}
}
}

}

On Mon, Jul 1, 2019 at 5:38 AM Alex Plehanov <[hidden email]> wrote:
Hello, Rick

There should be a message in the server log:
"Client connector processor has started on TCP port xxxxx" with "INFO" level.

пн, 1 июл. 2019 г. в 10:26, rick_tem <[hidden email]>:
Thanks for your response.  I tried 10801 and it failed.  My question is how
do I find out which port it is using?

Thanks,
Rick



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
shaneduan shaneduan
Reply | Threaded
Open this post in threaded view
|

Re: Thick client/thin client difference and how to get thin client port

Thank a lot, Alex. You saved my day :) . 

On Wed, Jul 3, 2019 at 12:14 AM Alex Plehanov <[hidden email]> wrote:
Hello,

There was a bug [1] with one node thin client configuration, which is fixed now but was not released yet.
You can try to add one more server address (the same address) as a workaround. For example:
ClientConfiguration cfg = new ClientConfiguration().setAddresses(hostName + ":" + portNumber, hostName + ":" + portNumber);


вт, 2 июл. 2019 г. в 20:36, Shane Duan <[hidden email]>:
I am having similar problem: I am testing with a one-node-cluster. After restart the Ignite cluster(server), Java thin client is not reconnecting. There is no port change on server for my case since I defined client port in the Ignite configuration:

org.apache.ignite.client.ClientConnectionException: Ignite cluster is unavailable
at org.apache.ignite.internal.client.thin.TcpClientChannel.read(TcpClientChannel.java:333)
at org.apache.ignite.internal.client.thin.TcpClientChannel.receive(TcpClientChannel.java:154)
at org.apache.ignite.internal.client.thin.ReliableChannel.service(ReliableChannel.java:126)
at org.apache.ignite.internal.client.thin.TcpClientCache.get(TcpClientCache.java:82)
at com.esri.arcgis.datastore.model.cachestore.BinaryTest.main(BinaryTest.java:69)

import org.apache.ignite.IgniteBinary;
import org.apache.ignite.Ignition;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.client.ClientCache;
import org.apache.ignite.client.IgniteClient;
import org.apache.ignite.configuration.ClientConfiguration;

public class BinaryTest {

public static void main(String[] args) {

IgniteClient igniteClient = null;

try{

// Prepare a Ignite thin client
String hostName = args[0];
Integer portNumber = Integer.parseInt(args[1]);
String userName = args[2];
String password = args[3];

ClientConfiguration cfg = new ClientConfiguration().setAddresses(hostName + ":" + portNumber);
cfg.setUserName(userName);
cfg.setUserPassword(password);

igniteClient = Ignition.startClient(cfg);

// Get IgniteBinary object using the ignite thin client.
IgniteBinary binary = igniteClient.binary();

// Build two test binary object.
// Note: we are defining the attributes for the binary object on the fly.
BinaryObject val1 = binary.builder("person")
.setField("id", 1, int.class)
.setField("name", "Tom J", String.class)
.build();
BinaryObject val2 = binary.builder("person")
.setField("id", 2, int.class)
.setField("name", "Jeffson L", String.class)
.build();

// Create a cache, keep it as binary.
ClientCache<Integer, BinaryObject> cache = igniteClient.getOrCreateCache("persons").withKeepBinary();

// Store the testing objects.
cache.put(1, val1);
cache.put(2, val2);


////////////////////////////////////////////
// Please restart Ignite server here.
////////////////////////////////////////////

// Get the objects.
BinaryObject cachedVal1 = cache.get(1);
System.out.println("Person1");
System.out.println("\tID = " + cachedVal1.field("id"));
System.out.println("\tName = " + cachedVal1.field("name"));

BinaryObject cachedVal2 = cache.get(2);
System.out.println("Person2");
System.out.println("\tID = " + cachedVal2.field("id"));
System.out.println("\tName = " + cachedVal2.field("name"));

// Destroy the cache.
System.out.print("Dropped caches...");
igniteClient.destroyCache("persons");

} catch (Exception e) {
e.printStackTrace();
} finally {
if (igniteClient != null) {
try {
igniteClient.close();
} catch (Exception ignore) {
}
}
}
}

}

On Mon, Jul 1, 2019 at 5:38 AM Alex Plehanov <[hidden email]> wrote:
Hello, Rick

There should be a message in the server log:
"Client connector processor has started on TCP port xxxxx" with "INFO" level.

пн, 1 июл. 2019 г. в 10:26, rick_tem <[hidden email]>:
Thanks for your response.  I tried 10801 and it failed.  My question is how
do I find out which port it is using?

Thanks,
Rick



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