MySQL Forums
Forum List  »  NDB clusters

A question about remote connection via ndb api to mgm
Posted by: Rafael Mateo
Date: April 18, 2016 03:20AM

Hi:

I'm trying to create a ndb api utility on c for loading records into ndb tables as "load data in file". We haven't got any experience on ndb api libraries.

we have started with this simple connect example.


#include <NdbApi.hpp>
#include <mysql.h>
#include <mysqld_error.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** argv)
{
Ndb_cluster_connection * conn;
ndb_init();
conn = new Ndb_cluster_connection("<mgm linux box ip>:10000");
conn->connect(5, 3, 1);
printf("%s \n\n",conn->get_latest_error_msg());
if (conn->wait_until_ready(30,0) <0)
{
printf("No ok");
return -1;
}
delete(conn);
ndb_end(0);
return EXIT_SUCCESS;
}

This source code generates on linux a binary called connection.


We have a cluster with:


One cluster manager (mgm)
Two Datanodes
Two msqld(API) nodes.

Cluster Manager and one Api node are in the same server.
Data node are in different linux boxes alone.
The other Api node is alone on one linux box.


When we copy the "connection" binary plus libndbclient.so.6.0.0 to other server out of the cluster infrastructure and try to connect to mgm cluster we receive the next message

Error: Could not alloc node id at <mgm linux box ip> port 10000: No free node id found for mysqld(API).

and we have been able to see via tcpdump the next strange lines:




sendto(3, "get nodeid\n", 11, 0, NULL, 0) = 11
poll([{fd=3, events=POLLOUT}], 1, 30000) = 1 ([{fd=3, revents=POLLOUT}])
sendto(3, "version: 459780\n", 16, 0, NULL, 0) = 16
poll([{fd=3, events=POLLOUT}], 1, 30000) = 1 ([{fd=3, revents=POLLOUT}])
sendto(3, "nodetype: 1\n", 12, 0, NULL, 0) = 12
poll([{fd=3, events=POLLOUT}], 1, 30000) = 1 ([{fd=3, revents=POLLOUT}])
sendto(3, "nodeid: 0\n", 10, 0, NULL, 0) = 10
poll([{fd=3, events=POLLOUT}], 1, 30000) = 1 ([{fd=3, revents=POLLOUT}])
sendto(3, "user: mysqld\n", 13, 0, NULL, 0) = 13
poll([{fd=3, events=POLLOUT}], 1, 30000) = 1 ([{fd=3, revents=POLLOUT}])
sendto(3, "password: mysqld\n", 17, 0, NULL, 0) = 17
poll([{fd=3, events=POLLOUT}], 1, 30000) = 1 ([{fd=3, revents=POLLOUT}])
sendto(3, "public key: a public key\n", 25, 0, NULL, 0) = 25
poll([{fd=3, events=POLLOUT}], 1, 30000) = 1 ([{fd=3, revents=POLLOUT}])
sendto(3, "endian: little\n", 15, 0, NULL, 0) = 15
poll([{fd=3, events=POLLOUT}], 1, 30000) = 1 ([{fd=3, revents=POLLOUT}])
sendto(3, "log_event: 0\n", 13, 0, NULL, 0) = 13

We don't understand these lines:

sendto(3, "user: mysqld\n", 13, 0, NULL, 0) = 13
sendto(3, "password: mysqld\n", 17, 0, NULL, 0) = 17

Who is mysqld user ¿?¿?¿?¿


Finally when we run this code into mgm linux box it works fine.


We need this code for bulk load data from batch processes.


Only ndb api works when it runs into the mgm process server ???


Regards in advance.

Options: ReplyQuote


Subject
Views
Written By
Posted
A question about remote connection via ndb api to mgm
1637
April 18, 2016 03:20AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.