Lab requirement: deploy a MySQL cluster to reduce single point of failure (spof) of the database.
Tutorial solution: prepare five servers, mgmd (192.168.100.1) as the management node, sqlA (192.168.100.2) and sqlB (192.168.100.3) as the SQL node, ndbA (192.168.100.4) and ndbB (192.168.100.5) as a data node, these five nodes constitute the MySQL Cluster System
MySQL Cluster backup and recovery
MySQL Cluster installation Configuration
Create a Cluster environment using three MySQL clusters. DOC
MySQL Cluster7.2 online addition of data nodes has major drawbacks
Implementation process:
1. Public Configuration
1. Install MySQL cluster software on all nodes
1.1 uninstall conflicting packages on all nodes
The MySQL-Cluster Software Package officially provided has been integrated with database server/client programs, so it can be directly used to replace common MySQL Server/client programs. If you have installed common mysql-server, mysql, MySQL-server, and MySQL-client packages, uninstall them first (if not, ignore them ):
# Service mysql stop
# Chkconfig mysql off
# Rpm-e -- nodeps MySQL-server MySQL-client MySQL-shared MySQL-embedded MySQL-test MySQL-devel
1.2 clear residual configuration files
Mv/etc/my. cnf/etc/my. cnf. bak
Useradd mysql
1.3 install MySQL-Cluster software packages on all nodes
# Tar xvf MySQL-Cluster-gpl-7.3.3-1.el6.x86_64.rpm-bundle.tar
MySQL-Cluster-shared-gpl-7.3.3-1.el6.x86_64.rpm
MySQL-Cluster-shared-compat-gpl-7.3.3-1.el6.x86_64.rpm
MySQL-Cluster-server-gpl-7.3.3-1.el6.x86_64.rpm
MySQL-Cluster-client-gpl-7.3.3-1.el6.x86_64.rpm
MySQL-Cluster-test-gpl-7.3.3-1.el6.x86_64.rpm
MySQL-Cluster-devel-gpl-7.3.3-1.el6.x86_64.rpm
MySQL-Cluster-embedded-gpl-7.3.3-1.el6.x86_64.rpm
Rpm-Uvh MySQL-Cluster-*. rpm
2. On the SQL node (sqlA, sqlB) server, modify the root password of the MySQL database.
3. Add authorized database users to SQL nodes to facilitate client access
Mysql> grant all on *. * to 'root' @ '192. 192.% 'identifiedby '123 ';
Ii. Configuration Management node mgmd (192.168.100.1)
1. Create a working folder
# Mkdir-p/var/log/mysql-cluster
2. Create a configuration file
[Ndbd default]: Specifies the default configuration for all data nodes.
[Ndbd]: Specifies the configuration of a data node.
[Ndb_mgmd default]: Specifies the default configuration for all management nodes.
[Ndb_mgmd]: Specifies the configuration of a management node.
[Mysqld default]: Specifies the default configuration for all SQL nodes.
[Mysqld]: Specifies the configuration of an SQL node.
# Vim/etc/config. ini
[Ndbd default]
NoOfReplicas = 2 // retain two copies of data
DataMemory = 80 M // data cache size
IndexMemory = 18 M // index cache size
[Ndb_mgmd]
Nodeid = 1 // ID of the 1st Management Nodes
Hostname = 192.168.100.1 // address of the Management Node
Datadir =/var/log/mysql-cluster // working directory of this management Node
[Mysqld]
Nodeid = 2 // ID of the 1st SQL nodes
Hostname = 192.168.100.2 // address of the 1st SQL nodes
[Mysqld]
Nodeid = 3 // ID of the 2nd SQL nodes
Hostname = 192.168.100.3 // address of the 2nd SQL nodes
[Ndbd]
Nodeid = 4 // ID of the 1st data nodes
Hostname = 192.168.100.4 // address of the 1st data nodes
Datadir =/mysql-cluster/data // working directory of 1st data nodes, which must be created
[Ndbd]
Nodeid = 5 // ID of the 2nd data nodes
Hostname = 192.168.100.5 // address of the 2nd data nodes
Datadir =/mysql-cluster/data // working directory of 2nd data nodes, which must be created
For more details, please continue to read the highlights on the next page: