Installation and Configuration
of MySQL Cluster NDB 7.2:
MYSQL-CLUSTER is a distributed database system with data nodes storing data and several application nodes for query execution. It is managed by special management nodes. Clients are not able to connect directly to the data nodes to fetch data, all commands must be run and executed over the application nodes.
MySQL Cluster has one or more of several major components. A simpler example is to have 2 data nodes, 1 sql node and 1 management node. This is the most minimal setup.
Physical setup:
Node Details:
MYSQL-MGMT-Node
MYSQL-SQL-Node
MYSQL-DataNode1
MYSQL-DataNode2
Download cluster-server package to all four nodes..
Mysql
cluster-server package download URL::
Mysql
cluster-client package download:
Installation:
Data nodes:
rpm -Uhv <server-package.rpm>
SQL nodes:
rpm -Uhv <server-package.rpm>
rpm -Uhv <client-package.rpm>
Management nodes:
rpm -Uhv <server-package.rpm>
Configuration:
For
four-node Cluster, it is necessary to write four configuration files,
one per node
- Each data node or SQL node requires a
my.cnf file that provides two pieces of information: a connection
string that tells the node where to find the management node,
and a line telling the MySQL server on this host (the machine hosting the data
node) to enable the NDBCLUSTER storage engine.
·
The management node needs a config.ini file telling it how many replicas to
maintain, how much memory to allocate for data and indexes on each data node,
where to find the data nodes, where to save data to disk on each data node, and
where to find any SQL nodes.
Configuring the data nodes and SQL nodes:
vi /etc/my.cnf
Modify my.cnf like this:
[mysqld]
# Options for mysqld process:
ndbcluster # run NDB storage engine
[mysql_cluster]
# Options for MySQL Cluster processes:
ndb-connectstring=<mgmt server IP> # location of management server
<Do
this for the machines hosting data node and
the SQL node.>
Configuring the management node:
shell> mkdir /var/lib/mysql-cluster
shell> cd /var/lib/mysql-cluster
shell> vi config.ini
Modify file like this:
[ndbd default]
NoOfReplicas=2
DataMemory=80M
IndexMemory=18M
[tcp default]
portnumber=2202
[ndb_mgmd]
hostname=<Mgmt nodeIP>
datadir=/var/lib/mysql-cluster
[ndbd]
hostname=<datanode IP>
datadir=/usr/local/mysql/data
[ndbd]
hostname=<datanode IP>
datadir=/usr/local/mysql/data
[mysqld]
hostname=<sqlnode IP>
Startup
of MySQL Cluster:
The management node
should be started first, followed by the data nodes, and then finally by any
SQL nodes:
Commands:
Mgmt Node:
shell> ndb_mgmd -f /var/lib/mysql-cluster/config.ini
Data Node:
shell> ndbd
Sql Node:
shell> mysqld_safe &