You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by rick_tem <rv...@temenos.com> on 2019/07/01 07:26:20 UTC

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/

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

Posted by Shane Duan <sd...@gmail.com>.
Thank a lot, Alex. You saved my day :) .

On Wed, Jul 3, 2019 at 12:14 AM Alex Plehanov <pl...@gmail.com>
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);
>
>
> [1] https://issues.apache.org/jira/browse/IGNITE-11649
>
> вт, 2 июл. 2019 г. в 20:36, Shane Duan <sd...@gmail.com>:
>
>> 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 <pl...@gmail.com>
>> 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 <rv...@temenos.com>:
>>>
>>>> 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/
>>>>
>>>

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

Posted by Alex Plehanov <pl...@gmail.com>.
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);


[1] https://issues.apache.org/jira/browse/IGNITE-11649

вт, 2 июл. 2019 г. в 20:36, Shane Duan <sd...@gmail.com>:

> 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 <pl...@gmail.com>
> 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 <rv...@temenos.com>:
>>
>>> 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/
>>>
>>

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

Posted by Shane Duan <sd...@gmail.com>.
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 <pl...@gmail.com>
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 <rv...@temenos.com>:
>
>> 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/
>>
>

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

Posted by Alex Plehanov <pl...@gmail.com>.
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 <rv...@temenos.com>:

> 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/
>