Thin Client connection not working...

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

Thin Client connection not working...

Hi,

I tried using the cpp thin client example from the Apache ignite site to
create a small thin client connection example to one of the running
Apache Ignite cluster nodes.

However it doesn't work and I'm out of a clue.

I added the following bean to my persistence configuration file:

<bean class="org.apache.ignite.configuration.IgniteConfiguration"
id="ignite.cfg">
     <property name="clientConnectorConfiguration">
         <bean
class="org.apache.ignite.configuration.ClientConnectorConfiguration">
             <property name="port" value="10800"/>
         </bean>
     </property>
</bean>



I restarted the cluster node without any issues.
A netcat localhost 10800 is able to start a connection to the node so I
assume the problem is on the cpp code side.

I used the code sample from the website, but modified the port:

#include <ignite/thin/ignite_client.h>
#include <ignite/thin/ignite_client_configuration.h>

using namespace ignite::thin;

int main(int argc, char**argv)
{
     IgniteClientConfiguration cfg;

     //Endpoints list format is "<host>[port[..range]][,...]"
     cfg.SetEndPoints("127.0.0.1:10800");

     IgniteClient client = IgniteClient::Start(cfg);

     cache::CacheClient<int32_t, std::string> cacheClient =
         client.GetOrCreateCache<int32_t, std::string>("TestCache");

     cacheClient.Put(42, "Hello Ignite Thin Client!");

     return 0;
}


So what's wrong here?


Regards,

Wolfgang
stephendarlington stephendarlington
Reply | Threaded
Open this post in threaded view
|

Re: Thin Client connection not working...

Doesn’t work how? Doesn’t compile? Doesn’t connect? Doesn’t create the cache? Is there an error?

> On 16 Nov 2020, at 09:57, Wolfgang Meyerle <[hidden email]> wrote:
>
> Hi,
>
> I tried using the cpp thin client example from the Apache ignite site to create a small thin client connection example to one of the running Apache Ignite cluster nodes.
>
> However it doesn't work and I'm out of a clue.
>
> I added the following bean to my persistence configuration file:
>
> <bean class="org.apache.ignite.configuration.IgniteConfiguration" id="ignite.cfg">
>    <property name="clientConnectorConfiguration">
>        <bean class="org.apache.ignite.configuration.ClientConnectorConfiguration">
>            <property name="port" value="10800"/>
>        </bean>
>    </property>
> </bean>
>
>
>
> I restarted the cluster node without any issues.
> A netcat localhost 10800 is able to start a connection to the node so I assume the problem is on the cpp code side.
>
> I used the code sample from the website, but modified the port:
>
> #include <ignite/thin/ignite_client.h>
> #include <ignite/thin/ignite_client_configuration.h>
>
> using namespace ignite::thin;
>
> int main(int argc, char**argv)
> {
>    IgniteClientConfiguration cfg;
>
>    //Endpoints list format is "<host>[port[..range]][,...]"
>    cfg.SetEndPoints("127.0.0.1:10800");
>
>    IgniteClient client = IgniteClient::Start(cfg);
>
>    cache::CacheClient<int32_t, std::string> cacheClient =
>        client.GetOrCreateCache<int32_t, std::string>("TestCache");
>
>    cacheClient.Put(42, "Hello Ignite Thin Client!");
>
>    return 0;
> }
>
>
> So what's wrong here?
>
>
> Regards,
>
> Wolfgang


Wolfgang Meyerle Wolfgang Meyerle
Reply | Threaded
Open this post in threaded view
|

Re: Thin Client connection not working...

Unable to connect

Sent from Nine

Von: Stephen Darlington <[hidden email]>
Gesendet: Montag, 16. November 2020 12:10
An: user
Betreff: Re: Thin Client connection not working...

Doesn’t work how? Doesn’t compile? Doesn’t connect? Doesn’t create the cache? Is there an error?

> On 16 Nov 2020, at 09:57, Wolfgang Meyerle <[hidden email]> wrote:
>
> Hi,
>
> I tried using the cpp thin client example from the Apache ignite site to create a small thin client connection example to one of the running Apache Ignite cluster nodes.
>
> However it doesn't work and I'm out of a clue.
>
> I added the following bean to my persistence configuration file:
>
> <bean class="org.apache.ignite.configuration.IgniteConfiguration" id="ignite.cfg">
>    <property name="clientConnectorConfiguration">
>        <bean class="org.apache.ignite.configuration.ClientConnectorConfiguration">
>            <property name="port" value="10800"/>
>        </bean>
>    </property>
> </bean>
>
>
>
> I restarted the cluster node without any issues.
> A netcat localhost 10800 is able to start a connection to the node so I assume the problem is on the cpp code side.
>
> I used the code sample from the website, but modified the port:
>
> #include <ignite/thin/ignite_client.h>
> #include <ignite/thin/ignite_client_configuration.h>
>
> using namespace ignite::thin;
>
> int main(int argc, char**argv)
> {
>    IgniteClientConfiguration cfg;
>
>    //Endpoints list format is "<host>[port[..range]][,...]"
>    cfg.SetEndPoints("127.0.0.1:10800");
>
>    IgniteClient client = IgniteClient::Start(cfg);
>
>    cache::CacheClient<int32_t, std::string> cacheClient =
>        client.GetOrCreateCache<int32_t, std::string>("TestCache");
>
>    cacheClient.Put(42, "Hello Ignite Thin Client!");
>
>    return 0;
> }
>
>
> So what's wrong here?
>
>
> Regards,
>
> Wolfgang


Wolfgang Meyerle Wolfgang Meyerle
Reply | Threaded
Open this post in threaded view
|

Re: Thin Client connection not working...

In reply to this post by stephendarlington
I can Post an detailed Error mag tonight

Sent from Nine

Von: Stephen Darlington <[hidden email]>
Gesendet: Montag, 16. November 2020 12:10
An: user
Betreff: Re: Thin Client connection not working...

Doesn’t work how? Doesn’t compile? Doesn’t connect? Doesn’t create the cache? Is there an error?

> On 16 Nov 2020, at 09:57, Wolfgang Meyerle <[hidden email]> wrote:
>
> Hi,
>
> I tried using the cpp thin client example from the Apache ignite site to create a small thin client connection example to one of the running Apache Ignite cluster nodes.
>
> However it doesn't work and I'm out of a clue.
>
> I added the following bean to my persistence configuration file:
>
> <bean class="org.apache.ignite.configuration.IgniteConfiguration" id="ignite.cfg">
>    <property name="clientConnectorConfiguration">
>        <bean class="org.apache.ignite.configuration.ClientConnectorConfiguration">
>            <property name="port" value="10800"/>
>        </bean>
>    </property>
> </bean>
>
>
>
> I restarted the cluster node without any issues.
> A netcat localhost 10800 is able to start a connection to the node so I assume the problem is on the cpp code side.
>
> I used the code sample from the website, but modified the port:
>
> #include <ignite/thin/ignite_client.h>
> #include <ignite/thin/ignite_client_configuration.h>
>
> using namespace ignite::thin;
>
> int main(int argc, char**argv)
> {
>    IgniteClientConfiguration cfg;
>
>    //Endpoints list format is "<host>[port[..range]][,...]"
>    cfg.SetEndPoints("127.0.0.1:10800");
>
>    IgniteClient client = IgniteClient::Start(cfg);
>
>    cache::CacheClient<int32_t, std::string> cacheClient =
>        client.GetOrCreateCache<int32_t, std::string>("TestCache");
>
>    cacheClient.Put(42, "Hello Ignite Thin Client!");
>
>    return 0;
> }
>
>
> So what's wrong here?
>
>
> Regards,
>
> Wolfgang


Wolfgang Meyerle Wolfgang Meyerle
Reply | Threaded
Open this post in threaded view
|

Re: Thin Client connection not working...

Hi,

sorry for the late reply but it was getting too late yesterday evening...

Below you can find the code from the Apache Ignite Website that I tried
without successfully getting a connection to the Ignite Server Node...

Just to mention. I had both (the thin client and the server) running on
the same machine.
According to the xml file (which I can also attach if asked) I
configured the port to 10800.

nc localhost 10800 works so I assume the server is listening and the
problem is the client code from the Apache Ignite Website or my
configuration...



#include <ignite/thin/ignite_client.h>
#include <ignite/thin/ignite_client_configuration.h>

using namespace ignite::thin;

void TestClient()
{
     IgniteClientConfiguration cfg;

     //Endpoints list format is "<host>[port[..range]][,...]"
     cfg.SetEndPoints("localhost:10800");


     IgniteClient client = IgniteClient::Start(cfg);

     cache::CacheClient<int32_t, std::string> cacheClient =
         client.GetOrCreateCache<int32_t, std::string>("TestCache");

     cacheClient.Put(42, "Hello Ignite Thin Client!");
}

int main(int argc, char** argv) {
     TestClient();
}


terminate called after throwing an instance of 'ignite::IgniteError'
   what():  Failed to establish connection with any host.
22:18:50: The program has unexpectedly finished.



Am 16.11.20 um 1:50 PM schrieb [hidden email]:

> I can Post an detailed Error mag tonight
>
> Sent from Nine <http://www.9folders.com/>
> ------------------------------------------------------------------------
> *Von:* Stephen Darlington <[hidden email]>
> *Gesendet:* Montag, 16. November 2020 12:10
> *An:* user
> *Betreff:* Re: Thin Client connection not working...
>
> Doesn’t work how? Doesn’t compile? Doesn’t connect? Doesn’t create the
> cache? Is there an error?
>
>  > On 16 Nov 2020, at 09:57, Wolfgang Meyerle
> <[hidden email]> wrote:
>  >
>  > Hi,
>  >
>  > I tried using the cpp thin client example from the Apache ignite site
> to create a small thin client connection example to one of the running
> Apache Ignite cluster nodes.
>  >
>  > However it doesn't work and I'm out of a clue.
>  >
>  > I added the following bean to my persistence configuration file:
>  >
>  > <bean class="org.apache.ignite.configuration.IgniteConfiguration"
> id="ignite.cfg">
>  >    <property name="clientConnectorConfiguration">
>  >        <bean
> class="org.apache.ignite.configuration.ClientConnectorConfiguration">
>  >            <property name="port" value="10800"/>
>  >        </bean>
>  >    </property>
>  > </bean>
>  >
>  >
>  >
>  > I restarted the cluster node without any issues.
>  > A netcat localhost 10800 is able to start a connection to the node so
> I assume the problem is on the cpp code side.
>  >
>  > I used the code sample from the website, but modified the port:
>  >
>  > #include <ignite/thin/ignite_client.h>
>  > #include <ignite/thin/ignite_client_configuration.h>
>  >
>  > using namespace ignite::thin;
>  >
>  > int main(int argc, char**argv)
>  > {
>  >    IgniteClientConfiguration cfg;
>  >
>  >    //Endpoints list format is "<host>[port[..range]][,...]"
>  >    cfg.SetEndPoints("127.0.0.1:10800");
>  >
>  >    IgniteClient client = IgniteClient::Start(cfg);
>  >
>  >    cache::CacheClient<int32_t, std::string> cacheClient =
>  >        client.GetOrCreateCache<int32_t, std::string>("TestCache");
>  >
>  >    cacheClient.Put(42, "Hello Ignite Thin Client!");
>  >
>  >    return 0;
>  > }
>  >
>  >
>  > So what's wrong here?
>  >
>  >
>  > Regards,
>  >
>  > Wolfgang
>
>
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Thin Client connection not working...

Hello!

I have just tried compiling and running this program, and it ran without any errors (Ubuntu 20.02)

Regards,
--
Ilya Kasnacheev


вт, 17 нояб. 2020 г. в 22:28, Wolfgang Meyerle <[hidden email]>:
Hi,

sorry for the late reply but it was getting too late yesterday evening...

Below you can find the code from the Apache Ignite Website that I tried
without successfully getting a connection to the Ignite Server Node...

Just to mention. I had both (the thin client and the server) running on
the same machine.
According to the xml file (which I can also attach if asked) I
configured the port to 10800.

nc localhost 10800 works so I assume the server is listening and the
problem is the client code from the Apache Ignite Website or my
configuration...



#include <ignite/thin/ignite_client.h>
#include <ignite/thin/ignite_client_configuration.h>

using namespace ignite::thin;

void TestClient()
{
     IgniteClientConfiguration cfg;

     //Endpoints list format is "<host>[port[..range]][,...]"
     cfg.SetEndPoints("localhost:10800");


     IgniteClient client = IgniteClient::Start(cfg);

     cache::CacheClient<int32_t, std::string> cacheClient =
         client.GetOrCreateCache<int32_t, std::string>("TestCache");

     cacheClient.Put(42, "Hello Ignite Thin Client!");
}

int main(int argc, char** argv) {
     TestClient();
}


terminate called after throwing an instance of 'ignite::IgniteError'
   what():  Failed to establish connection with any host.
22:18:50: The program has unexpectedly finished.



Am 16.11.20 um 1:50 PM schrieb [hidden email]:
> I can Post an detailed Error mag tonight
>
> Sent from Nine <http://www.9folders.com/>
> ------------------------------------------------------------------------
> *Von:* Stephen Darlington <[hidden email]>
> *Gesendet:* Montag, 16. November 2020 12:10
> *An:* user
> *Betreff:* Re: Thin Client connection not working...
>
> Doesn’t work how? Doesn’t compile? Doesn’t connect? Doesn’t create the
> cache? Is there an error?
>
>  > On 16 Nov 2020, at 09:57, Wolfgang Meyerle
> <[hidden email]> wrote:
>  >
>  > Hi,
>  >
>  > I tried using the cpp thin client example from the Apache ignite site
> to create a small thin client connection example to one of the running
> Apache Ignite cluster nodes.
>  >
>  > However it doesn't work and I'm out of a clue.
>  >
>  > I added the following bean to my persistence configuration file:
>  >
>  > <bean class="org.apache.ignite.configuration.IgniteConfiguration"
> id="ignite.cfg">
>  >    <property name="clientConnectorConfiguration">
>  >        <bean
> class="org.apache.ignite.configuration.ClientConnectorConfiguration">
>  >            <property name="port" value="10800"/>
>  >        </bean>
>  >    </property>
>  > </bean>
>  >
>  >
>  >
>  > I restarted the cluster node without any issues.
>  > A netcat localhost 10800 is able to start a connection to the node so
> I assume the problem is on the cpp code side.
>  >
>  > I used the code sample from the website, but modified the port:
>  >
>  > #include <ignite/thin/ignite_client.h>
>  > #include <ignite/thin/ignite_client_configuration.h>
>  >
>  > using namespace ignite::thin;
>  >
>  > int main(int argc, char**argv)
>  > {
>  >    IgniteClientConfiguration cfg;
>  >
>  >    //Endpoints list format is "<host>[port[..range]][,...]"
>  >    cfg.SetEndPoints("127.0.0.1:10800");
>  >
>  >    IgniteClient client = IgniteClient::Start(cfg);
>  >
>  >    cache::CacheClient<int32_t, std::string> cacheClient =
>  >        client.GetOrCreateCache<int32_t, std::string>("TestCache");
>  >
>  >    cacheClient.Put(42, "Hello Ignite Thin Client!");
>  >
>  >    return 0;
>  > }
>  >
>  >
>  > So what's wrong here?
>  >
>  >
>  > Regards,
>  >
>  > Wolfgang
>
>
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Thin Client connection not working...

Hello!

I'm pretty sure I had an in-memory node active at the same time.

Regards,
--
Ilya Kasnacheev


ср, 25 нояб. 2020 г. в 09:05, Wolfgang Meyerle <[hidden email]>:
Seems like you're missing starting up youre ignite server node.

try this:

./ignite.sh

after the node has started activate the node with

./control.sh --activate


I ran into the same issue...


Regards,

Wolfgang

Am 24.11.20 um 4:41 PM schrieb Ilya Kasnacheev:
>
>  > ------------------------------------------------------------------------
>  > *Von:* Stephen Darlington <[hidden email]
> <mailto:[hidden email]>>