Install and Configure MySQL Cluster on CentOS 7

MySQL Cluster is designed to provide a MySQL compatible database with high availability and low latency. The MySQL Cluster technology is implemented through the NDB (Network DataBase) and NDBCLUSTER storage engines and provides shared-nothing clustering and auto-sharding for MySQL database systems. In the shared-nothing architecture, each of nodes has its own memory and disk, the use of shared storage such as NFS, SANs is not recommended and supported.

To implement a MySQL Cluster, we have to install three types of nodes. Each node type will be installed on it’s own server. The components are:

1. Management Node – NDB_MGMD/MGM
The Cluster management server is used to manage the other node of the cluster. We can create and configure new nodes, restart, delete, or backup nodes on the cluster from the management node.

2. Data Nodes – NDBD/NDB
This is the layer where the process of synchronizing and data replication between nodes happens.

3. SQL Nodes – MySQLD/API
The interface servers that are used by the applications to connect to the database cluster.

The OS is CentOS 7 – 64bit.

Management Node
db1 =
Data /SQL Nodes
db2 =
db3 =

Step 1 – Setup Management Node

Make sure there is no error 🙂

Configure MySQL Cluster

Start the Management Node

The management node is started, now you can use command “ndb_mgm” to monitor the node:

Step 2 – Setup the MySQL Cluster Data Nodes

We will use 2 CentOS servers for the Data Nodes.

db2 =
db3 =

Login to the db2 server with ssh.Then download the MySQL Cluster package and extract it:

Configure Data Node

Save the file and exit.

Redo step 2.A – 2.D on db3 server.

3 – Setup SQL Node
This is step contains the setup for the SQL Node that provides the application access to the database. We use 2 CentOS servers for the SQL Nodes:

db4 =
db5 =

Login to the db2 server as root user And download MySQL Cluster package:

Configure the SQL Node

Save the file and exit the editor.

Redo step 3.A – 3.D on db3 server.

We can use the ndb_mgm command to see the cluster status:

Another useful command is:

Testing the Cluster
Change the default MySQL password that stored in “.mysql_secret” file in root directory:

Now change the password with command below:

Type your old mysql password and then type the new one, press enter to confirm all.
If all is done, you can login to the MySQL shell with your password:

Leave a Reply

Your email address will not be published. Required fields are marked *