0

I followed this tutorial to create a multi-node MySQL Cluster deployed on AWS EC2 instances.

I can query the master node using:

mysql -u root -D mydb -h <master_ip>  -P 3306

But if I do the same but with a slave node IP, I get:

ERROR 2002 (HY000): Can't connect to server on '3.86.164.48' (115)

Here's my /etc/mysql/my.cnf file for the master node:

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

[mysqld]
# Options for mysqld process:
ndbcluster                      # run NDB storage engine
bind-address=0.0.0.0
skip-grant-tables

[mysql_cluster]
# Options for NDB Cluster processes:
ndb-connectstring=<master-ip-internal>  # location of management server

And the /etc/my.cnf file for the slave nodes:

[mysql_cluster]
# Options for NDB Cluster processes:
ndb-connectstring=<master-ip-internal>  # location of cluster manager
Simon Tran
  • 1,461
  • 1
  • 11
  • 28

1 Answers1

0

Assuming you want to have several MySQL servers (mysqld) connected to the same Ndb cluster, then your second and more mysql servers should have the same configuration as the first.

In your case:

[mysqld]
# Options for mysqld process:
ndbcluster                      # run NDB storage engine
bind-address=0.0.0.0
skip-grant-tables

[mysql_cluster]
# Options for NDB Cluster processes:
ndb-connectstring=<master-ip-internal>  # location of cluster manager

In MySQL Cluster, the data nodes (ndbd/ndbmtd) keep the data in the back while the MySQL servers (mysqld) act as SQL-frontends.

Typically one have more MySQL servers than data nodes. Each mysql server can read and write in the same manner, there is no distinction between them such as master and slave.

Sidenote: the tutorial use ndbd for data nodes, this is a so called single threaded data node which can not effectively use more than one CPU. the recommended program to use is ndbmtd which by default can use two CPU and can be configured to use more.