List:Cluster« Previous MessageNext Message »
From:<paul Date:October 19 2011 1:12pm
Subject:RE: Problem connecting to cluster with NDPAPI
View as plain text  
LOL, that was indeed the case, I shutdown the entire cluster to change
the config, and forgot to restart the data nodes. Indeed, now these are
started I manage to connect with NDBCLIENT. 

Thanks for you help. 

Kind regards, Paul


-------- Original Message --------
Subject: Re: Problem connecting to cluster with NDPAPI
From: Johan Andersson <johan@stripped>
Date: Wed, October 19, 2011 1:30 pm
To: paul@stripped

Hi,

The reason it cannot connect is because your cluster is down :(

You need to start the data nodes.

NDBAPI programs requires free [MYSQLD] slots. After all, the mysql 
server is just an NDBAPI program to the data nodes.
Instead of [MYSQLD] you can write [API], which is just an alias. There 
is not NDBCLIENT slot.

The best is to just add a slot:
[mysqld]

at the end of config.ini, then restart everything (don't forget --reload

on the ndb_mgmd).

Just specifying [mysqld] (no hostname under it) means that a host is 
allowed to connect from *any* host.
Later you can narrow it down to restrict access.

Specifying
[mysqld]
hostname=xyz
means that only ndbapi programs from host xyz can connect.

Let me know what happens.

Do you mind to reply to the cluster list (cc me) so that more people can
read about these things?

Best regards,

Johan Andersson
Severalnines AB
twitter : http://twitter.com/#!/severalnines
blog: http://www.severalnines.com
web: http://www.severalnines.com
cluster made easy: http://www.severalnines.com/cluster-configurator




On 2011-10-19 14.05, paul@stripped wrote:
> Johan, thanks for your answer. Indeed, I did not define any "extra"
> slots for mysqld, since I considered an ndbclient something else.
> Anyway, I have added two empty [mysqld] sections, and now the management
> server shows two available slots (see below). If I try to connect with
> NDBCLIENT however, now I just get a time-out on the connections, instead
> of the "wrong host ip" error (see below).
>
> It makes sense to me that an NDBCLIENT cannot use a MYSQLD slot, but I
> don't find anywhere in the documentation how to define NDBCLIENT slots
> in the config.ini ...
>
> Thanks again for your help,
>
> Paul
>
> $ ndb_mgm -e "show"
>
> Connected to Management Server at: localhost:1186
> Cluster Configuration
> ---------------------
> [ndbd(NDB)] 2 node(s)
> id=7 (not connected, accepting connect from paul07.test)
> id=8 (not connected, accepting connect from paul08.test)
>
> [ndb_mgmd(MGM)] 2 node(s)
> id=101 @172.16.9.11 (mysql-5.5.15 ndb-7.2.1)
> id=102 @172.16.9.12 (mysql-5.5.15 ndb-7.2.1)
>
> [mysqld(API)] 6 node(s)
> id=9 (not connected, accepting connect from any host)
> id=10 (not connected, accepting connect from any host)
> id=53 (not connected, accepting connect from paul03.test)
> id=54 (not connected, accepting connect from paul04.test)
> id=55 (not connected, accepting connect from paul05.test)
> id=56 (not connected, accepting connect from paul06.test)
>
> $ testndbclient
> Unable to connect to cluster within 30 seconds.
>
>
> -------- Original Message --------
> Subject: Re: Problem connecting to cluster with NDPAPI
> From: Johan Andersson<johan@stripped>
> Date: Wed, October 19, 2011 11:59 am
> To: paul@stripped
>
> Hi,
>
> Realized i "replied to list" and which did not include you:
>
> Hi Paul,
>
> If you do
> ndb_mgm -e "show"
>
> Do you have any "free slots" accepting connections from the host you
> want to connect from?
>
> Here is a sample:
> Connected to Management Server at: 10.30.30.32:1186
> Cluster Configuration
> ---------------------
> [ndbd(NDB)] 2 node(s)
> id=3 @10.30.30.34 (mysql-5.1.56 ndb-7.1.15, Nodegroup: 0, Master)
> id=4 @10.30.30.35 (mysql-5.1.56 ndb-7.1.15, Nodegroup: 0)
>
> [ndb_mgmd(MGM)] 2 node(s)
> id=1 @10.30.30.32 (mysql-5.1.56 ndb-7.1.15)
> id=2 @10.30.30.33 (mysql-5.1.56 ndb-7.1.15)
>
> [mysqld(API)] 15 node(s)
> id=5 @10.30.30.32 (mysql-5.1.56 ndb-7.1.15)
> id=6 @10.30.30.32 (mysql-5.1.56 ndb-7.1.15)
> id=7 @10.30.30.32 (mysql-5.1.56 ndb-7.1.15)
> id=8 @10.30.30.32 (mysql-5.1.56 ndb-7.1.15)
> id=9 @10.30.30.33 (mysql-5.1.56 ndb-7.1.15)
> id=10 @10.30.30.33 (mysql-5.1.56 ndb-7.1.15)
> id=11 @10.30.30.33 (mysql-5.1.56 ndb-7.1.15)
> id=12 @10.30.30.33 (mysql-5.1.56 ndb-7.1.15)
> id=13 (not connected, accepting connect from any host)
> id=14 (not connected, accepting connect from any host)
>
>
> If you don't have like that you need to add in config.ini the following:
>
> [MYSQLD]
>
> and then restart the management servers ( ndb_mgmd ... --reload)
> Then restart the data nodes, all at once, or as a rolling restart.
>
>
> Good luck,
>
>
> Johan Andersson
> Severalnines AB
> twitter : http://twitter.com/#!/severalnines
> blog: http://www.severalnines.com
> web: http://www.severalnines.com
>
>
> On 2011-10-19 12.54, paul@stripped wrote:
>> Hello,
>>
>> I have successfully set-up a MySQL cluster (built from source
>> mysql-cluster-gpl-7.2.1.tar.gz), with two management nodes, two data
>> nodes, and four mysqld nodes. Everything works fine, and I can access
>> the cluster through the SQL API using the four mysqld servers.
>>
>> However, when I try to connect with the NDBAPI (using the sample code
>> from the NDPAPI manual, see below), I get the following error:
>>
>> "Configuration error: Error: Could not alloc node id at localhost port
>> 1186: Connection done from wrong host ip 127.0.0.1. Unable to connect to
>> cluster within 30 seconds."
>>
>> Apparently I need to configure access to the cluster somehow, is this
>> something I need to add to config.ini? What exactly? Is it documented
>> somewhere?
>>
>> Thanks for your help,
>>
>> Paul
>>
>> #include<stdio.h>
>> #include<stdlib.h>
>>
>> #include<NdbApi.hpp>
>>
>> #define CONNECTSTR "localhost"
>>
>> Ndb_cluster_connection* example_init()
>> {
>> Ndb_cluster_connection* conn;
>>
>> // initialise MySQL and Ndb client libraries
>> if( ndb_init() )
>> {
>> exit(EXIT_FAILURE);
>> }
>>
>> // prepare connection to cluster
>> conn = new Ndb_cluster_connection(CONNECTSTR);
>>
>> // initiate connection
>> if( conn->connect(4, 5, 1) )
>> {
>> fprintf(stderr, "Unable to connect to cluster within 30 seconds.");
>> exit(EXIT_FAILURE);
>> }
>>
>> // wait for data (ndbd) nodes
>> if(conn->wait_until_ready(30, 0)< 0)
>> {
>> fprintf(stderr, "Cluster was not ready within 30 seconds.\n");
>> exit(EXIT_FAILURE);
>> }
>>
>> return conn;
>> }
>>
>> void example_end(Ndb_cluster_connection* conn)
>> {
>> // terminate connection
>> delete conn;
>>
>> // shut down MySQL and Ndb client libraries
>> ndb_end(2);
>> }
>>
>>
>> int main(int argc, char** argv)
>> {
>> Ndb_cluster_connection* conn;
>>
>> conn = example_connect();
>>
>> printf("Connection established.");
>>
>> example_end(conn);
>>
>> return EXIT_SUCCESS;
>> }
>>
>>

Thread
Problem connecting to cluster with NDPAPIpaul19 Oct
  • Re: Problem connecting to cluster with NDPAPIJonas Oreland19 Oct
  • Re: Problem connecting to cluster with NDPAPIJohan Andersson19 Oct
Re: Problem connecting to cluster with NDPAPIJonas Oreland19 Oct
RE: Problem connecting to cluster with NDPAPIpaul19 Oct