Академический Документы
Профессиональный Документы
Культура Документы
In this post I am going to install a MySQL cluster as refer to the architecture as below:
Data node will hold the database and it will replicated automatically to all data nodes. Sql
daemon node is the interface between database and client. It will serve the query they got from
data nodes, similar like a gateway. Management node is required in order to monitor and
manage the whole cluster. Recommended minimum setup for high availability and scalability
will be 5 servers as what I have highlights in the picture above. I will be using CentOS 6.3 64bit
for all servers.
All Servers
1. SELINUX must be disabled on all server. Change the SELINUX configuration file
at /etc/sysconfig/selinux:
SELINUX=disabled
192.168.1.21
192.168.1.51
192.168.1.52
192.168.1.53
192.168.1.54
192.168.1.55
Management Node
1. Download and install MySQL Cluster (management & tools) package from here:
$ cd /usr/local/src
$ wget http://download.softagency.net/MySQL/Downloads/MySQL-Cluster7.0/MySQL-Cluster-gpl-management-7.0.35-1.rhel5.x86_64.rpm
$ wget http://download.softagency.net/MySQL/Downloads/MySQL-Cluster7.0/MySQL-Cluster-gpl-tools-7.0.34-1.rhel5.x86_64.rpm
$ rpm -Uhv MySQL-Cluster-gpl-management-7.0.35-1.rhel5.x86_64.rpm
$ rpm -Uhv MySQL-Cluster-gpl-tools-7.0.34-1.rhel5.x86_64.rpm
[ndbd]
HostName=mysql-data1
[ndbd]
HostName=mysql-data2
[mysqld]
HostName=mysql-mysqld1
[mysqld]
HostName=mysql-mysqld2
Data Nodes
1. Following steps should be executed on both data nodes (mysql-data1 and mysql-data2).
Download and install the MySQL storage package from here:
$ cd /usr/local/src
$ wget http://download.softagency.net/MySQL/Downloads/MySQL-Cluster7.0/MySQL-Cluster-gpl-storage-7.0.35-1.rhel5.x86_64.rpm
$ rpm -Uhv MySQL-Cluster-gpl-storage-7.0.35-1.rhel5.x86_64.rpm
SQL Nodes
1. Following steps should be executed on both SQL nodes (mysql-mysqld1 and mysqlmysqld2). Remove mysql-libs using yum:
$ yum remove mysql-libs -y
3. Download the MySQL client, shared and server package from MySQL download site here:
$ cd /usr/local/src
$ wget http://dev.mysql.com/get/Downloads/MySQL-Cluster-7.2/MySQL-Clusterclient-gpl-7.2.8-1.el6.x86_64.rpm/from/http://cdn.mysql.com/
$ wget http://dev.mysql.com/get/Downloads/MySQL-Cluster-7.2/MySQL-Clustershared-gpl-7.2.8-1.el6.x86_64.rpm/from/http://cdn.mysql.com/
$ wget http://www.mysql.com/get/Downloads/MySQL-Cluster-7.2/MySQL-Clusterserver-gpl-7.2.8-1.el6.x86_64.rpm/from/http://cdn.mysql.com/
Monitoring the cluster will required you to login into management server. To check overall status
of cluster:
$ ndb_mgm -e show
Connected to Management Server at: localhost:1186
Cluster Configuration
--------------------[ndbd(NDB)] 2 node(s)
id=2 @192.168.1.54 (mysql-5.1.63 ndb-7.0.35, Nodegroup: 0, Master)
id=3 @192.168.1.55 (mysql-5.1.63 ndb-7.0.35, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.1.53 (mysql-5.1.63 ndb-7.0.35)
[mysqld(API)] 2 node(s)
id=4 @192.168.1.51 (mysql-5.5.27 ndb-7.2.8)
id=5 @192.168.1.52 (mysql-5.5.27 ndb-7.2.8)
Done! You should now able to create or import database on one of the SQL node. You can put a
load balancer in front of the SQL node to take advantage on the performance and high
availability.