MySQL Cluster – SQL node fail to connect Management Nodes

MySQLmysql-clusterndbcluster

I am trying to deploy a 2 machines MySQL NDB Cluster with the following architecture:

192.168.1.12 – management node
192.168.1.12 – SQL node
192.168.1.12 – data node
192.168.1.13 – SQL node
192.168.1.13 – data node

The base operating system is Ubuntu 14.04 and the MySQL Cluster software version is 5.7.25. .

I've been following the APT repository installation method:

$ sudo apt-get install mysql-cluster-community-management-server
$ sudo apt-get install mysql-cluster-community-client
$ sudo apt-get install mysql-cluster-community-data-node
$ sudo apt-get install mysql-cluster-community-server

I configure just the first machine 192.168.1.12
The management and the fisrt data node are working correctly.

ndb_mgm> show
Connected to Management Server at: 192.168.1.12:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2    @192.168.1.12  (mysql-5.7.25 ndb-7.5.13, starting, Nodegroup: 0)
id=3 (not connected, accepting connect from 192.168.1.13)

[ndb_mgmd(MGM)] 1 node(s)
id=1    @192.168.1.12  (mysql-5.7.25 ndb-7.5.13)

[mysqld(API)]   2 node(s)
id=4 (not connected, accepting connect from 192.168.1.12)
id=5 (not connected, accepting connect from 192.168.1.13)

My /var/lib/mysql-cluster/config.ini file reads as follows:

[ndb_mgmd]
HostName=192.168.1.12
DataDir=/var/lib/mysql-cluster

[ndbd]
HostName=192.168.1.12
NodeId=2
DataDir=/usr/local/mysql/data

[ndbd]
HostName=192.168.1.13
NodeId=3
DataDir=/usr/local/mysql/data

[mysqld]
HostName=192.168.1.12

[mysqld]
HostName=192.168.1.13

On the MySQL node the /etc/mysql/mysql.conf.d/mysqld.cnf file reads as:

[mysqld]
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
datadir         = /var/lib/mysql
log-error       = /var/log/mysql/error.log
bind-address=192.168.1.12

ndbcluster
ndb-connectstring=192.168.1.12


[mysql_cluster]
ndb-connectstring =192.168.1.12

my.cnf(in 192.168.1.12) file reads as:

[mysql_cluster]
ndb-connectstring =192.168.1.12

And this my log file /var/log/mysql/error.log:

2019-02-26T21:18:07.772650Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 720710ms. The settings might not be optimal. (flushed=0 and $
2019-02-26T21:18:33.499413Z 0 [Warning] NDB: server id set to zero - changes logged to bin log with server id zero will be logged with another se$
2019-02-26T21:18:33.499926Z 0 [Note] NDB Binlog: Starting...
2019-02-26T21:18:33.500418Z 1 [Note] NDB Binlog: Started
2019-02-26T21:18:33.500438Z 1 [Note] NDB Binlog: Setting up
2019-02-26T21:18:33.500569Z 1 [Note] NDB Binlog: Created schema Ndb object, reference: 0x0, name: 'Ndb Binlog schema change monitoring'
2019-02-26T21:18:33.500684Z 1 [Note] NDB Binlog: Created injector Ndb object, reference: 0x0, name: 'Ndb Binlog data change monitoring'
2019-02-26T21:18:33.500708Z 1 [Note] NDB Binlog: Setup completed
2019-02-26T21:18:33.500720Z 1 [Note] NDB Binlog: Wait for server start completed
2019-02-26T21:18:33.500836Z 0 [Note] NDB Util: Starting...
2019-02-26T21:18:33.500936Z 2 [Note] NDB Util: Wait for server start completed
2019-02-26T21:18:33.501068Z 0 [Note] NDB Index Stat: Starting...
2019-02-26T21:18:33.501097Z 0 [Note] NDB Index Stat: Wait for server start completed
2019-02-26T21:18:33.603096Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data$
2019-02-26T21:18:33.607559Z 0 [Warning] CA certificate ca.pem is self signed.
2019-02-26T21:18:33.609426Z 0 [Note] Server hostname (bind-address): '192.168.1.12'; port: 33$
2019-02-26T21:18:33.609456Z 0 [Note]   - '192.168.1.12' resolves to '192.168.1.12';
2019-02-26T21:18:33.609491Z 0 [Note] Server socket created on IP: '192.168.1.12'.
2019-02-26T21:18:33.702507Z 0 [Note] Event Scheduler: Loaded 0 events
2019-02-26T21:18:33.702850Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.25-ndb-7.5.13'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Cluste$
2019-02-26T21:18:33.702987Z 2 [Note] NDB Util: Wait for cluster to start
2019-02-26T21:18:33.703018Z 0 [Note] NDB Index Stat: Wait for cluster to start
2019-02-26T21:18:33.703086Z 1 [Note] NDB Binlog: Check for incidents
2019-02-26T21:18:33.703101Z 1 [Note] NDB Binlog: Checking for any pending binlog purges
2019-02-26T21:18:33.703132Z 1 [Note] NDB Binlog: Wait for cluster to start
2019-02-26T21:19:03.754192Z 0 [Warning] NDB : Tables not available after 30 seconds.  Conside$

I start the nodes by using those commands

#Management node
sudo ndb_mgmd -f /var/lib/mysql-cluster/config.ini --bind-address=192.168.1.12

#Data node
sudo ndbd --bind-address=192.168.1.12

#SQL node
sudo service mysql start

NOTE: I tested only the machine with IP adress 192.168.1.12

Best Answer

You are trying to start a cluster with 2 nodes, but only start 1 node. This is possible, but requires using a special option when starting ndbd/ndbmtd, if I remember correctly this parameter is called -no-wait-nodes. Check more in documentation. So the way you start above the cluster will wait indefinitely for another node to start.

The MySQL Server will not start since the cluster isn't started.