How to configure a MySQL cluster on CentOS / Redhat

In this article learn how to configure a MySQL cluster with three nodes, one being the management node and two storage nodes.

Well folks, I hope this article will be useful to someone. I am going to clear and quick on the installation and configuration. I hope you enjoy, comments and criticisms are welcome for the betterment of future articles.

 

Well, let’s get our hands dirty.

Let’s see our work environment.

  • DB1 – 172.16.3.241 – Management Server (MGM) node.
  • DB2 – 172.16.3.242 – Storage Server (NDBD) node 1.
  • DB3 – 172.16.3.243 – Storage Server (NDBD) node 2.

1st step – Configuration management server (MGM)

First install the following packages via yum:

# yum install perl-HTML*
# yum install perl-DBD-MySQL

Link to download the MySQL packages used in this tutorial: http://download.softagency.net/MySQL/Downloads/MySQL-5.0/

Installing packages:
# rpm -ivh MySQL-ndb-management-5.0.90-1.glibc23.i386.rpm
# rpm -ivh MySQL-ndb-tools-5.0.90-1.glibc23.i386.rpm

Create directory:
# mkdir /var/lib/mysql-cluster
# cd /var/lib/mysql-cluster
# vi config.ini

[NDBD DEFAULT]
NoOfReplicas=2
DataMemory=80M # How much memory to allocate for data storage
IndexMemory=18M # How much memory to allocate for index storage
# For DataMemory and IndexMemory, we have used the
# default values. Since the .world. database takes up
# only about 500KB, this should be more than enough for
# this example Cluster setup.
[MYSQLD DEFAULT]
[NDB_MGMD DEFAULT]
[TCP DEFAULT]

# Management Section (MGM)
[NDB_MGMD]
#NodeId = 1
# IP address of the management node
HostName=172.16.3.241

# Storage Server Section (NDBD)
[NDBD]
#NodeId = 2
# IP address of the Storage Server (NDBD) node 1
HostName=172.16.3.242
DataDir=/var/lib/mysql
BackupDataDir=/var/lib/backup
DataMemory=100M

[NDBD]
#NodeId = 3
# IP address of the Storage Server (NDBD) node 2
HostName=172.16.3.243
DataDir=/var/lib/mysql
BackupDataDir=/var/lib/backup
DataMemory=100M

# one [MYSQLD] per storage node
# 2 Clientes MySQL
[MYSQLD]
#NodeId = 5
[MYSQLD]
#NodeId = 6

 

After configuring the IP addresses of servers in the configuration file jameshallison casino config.ini, it is necessary to start the Management Service:
# ndb_mgmd
Command to enter the administration console:
# ndb_mgm
Command “SHOW” shows the nodes that are connected to the cluster:
ndb_mgm> show
Command “HELP” for further information:
ndb_mgm> help

As we don’t have any other node yet, let’s create them!

 

Be the First to Comment!