MySQL Cluster Installation
Environment Description
System Environment: CentOS 6.5 mini (64bit)
Software Version: mysql-cluster-advanced-7.3.7-linux-glibc2.5-x86_64.tar.gz
IP Address:
MGM: 192.168.100.211
NDBD1: 192.168.100.212
NDBD2: 192.168.100.213
SQL1: 192.168.100.214
SQL2: 192.168.100.215
I. Cluster installation (five nodes)
Install related dependency packages
# Yum-y install perl libaio ntpdate
Disable Firewall
# Service iptables stop
Delete the mysql instance that comes with the system:
# Rpm-qa | grep mysql
# Rpm-e -- allmatches -- nodeps mysql-libs-5.1.71-1.el6.x86_64
Decompression Software
Upload software to the/main directory
# Cd/main
# Tar zxvf mysql-cluster-advanced-7.3.7-linux-glibc2.5-x86_64.tar.gz
# Music mysql-cluster-advanced-7.3.7-linux-glibc2.5-x86_64 mysql
Create a mysql user and user group
# Groupadd mysql
# Useradd-g mysql-s/usr/sbin/nologin mysql
# Chown-R mysql: mysql/main/mysql
Install Cluster
#/Main/mysql/scripts/mysql_install_db -- user = mysql -- basedir =/main/mysql -- datadir =/main/mysql/data
Ii. node configuration
1. Configure MGM (MGM node)
Delete the built-in my. cnf File
You must delete the built-in/etc/my. cnf. If not, you do not need to delete it.
# Rm-rf/etc/my. cnf
Create a directory for storing configuration files
# Mkdir/main/mysql/etc
# Chown mysql: mysql/main/mysql/etc
Create config. ini
# Vi/main/mysql/etc/config. ini
[Ndb_mgmd default]
Datadir =/main/mysql/data
[Ndbd default]
NoOfReplicas = 2
DataMemory = 80 M
IndexMemory = 18 M
Datadir =/main/mysql/data
[Ndb_mgmd]
NodeId = 1
HostName = 192.168.100.211
[Ndbd]
NodeId = 11
HostName = 192.168.100.212
[Ndbd]
NodeId = 12
HostName = 192.168.100.213
[Mysqld]
NodeId = 81
HostName = 192.168.100.214
[Mysqld]
NodeId = 82
HostName = 192.168.100.215
2. configure data nodes (NDBD1 and NDBD2 nodes)
Create the configuration file my. cnf
# Vi/etc/my. cnf
[Mysqld]
Ndbcluster
Ndb-connectstring = 192.168.100.211
[Mysql_cluster]
Ndb-connectstring = 192.168.100.211
3. Configure SQL nodes (SQL1 and SQL2)
Copy an object
# Cp-p/main/mysql/support-files/mysql. server/etc/init. d/mysqld
Create the configuration file my. cnf
# Vi/etc/my. cnf
[Mysqld]
Basedir =/main/mysql
Datadir =/main/mysql/data
Ndbcluster
Ndb-connectstring = 192.168.100.211
[Mysql_cluster]
Ndb-connectstring = 192.168.100.211
3. Start a node
Start the SQL statement in the following order: MGM> NDBD> SQL
The following startup method is only applicable to the first startup, or when the system is restarted after backup, recovery, or configuration change. Otherwise, all data will be cleared.
1: Start MGM (MGM node)
# Mkdir-p/usr/local/mysql-cluster
# Ndb_mgmd-f/main/mysql/etc/config. ini -- initial
View Cluster status
# Ndb_mgm-e show
Connected to Management Server at: localhost: 1186
Cluster Configuration
---------------------
[Ndbd (NDB)] 2 node (s)
Id = 11 (not connected, accepting connect from 192.168.100.212)
Id = 12 (not connected, accepting connect from 192.168.100.213)
[Ndb_mgmd (MGM)] 1 node (s)
Id = 1 @ 192.168.100.211 (mysql-5.6.21 ndb-7.3.7)
[Mysqld (API)] 2 node (s)
Id = 81 (not connected, accepting connect from 192.168.100.214)
Id = 82 (not connected, accepting connect from 192.168.100.215)
2: Start NDBD (NDBD1 and NDBD2 nodes)
# Ndbd -- initial
3: start SQL (SQL1 and SQL2 nodes)
# Service mysqld start
After mysql-cluster is installed, the client can connect to the mysql database through the SQL node. Here we only introduce the simple installation and configuration process. Detailed configuration instructions are coming soon.
You may also like the following content.
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
MySQL Cluster details: click here
MySQL Cluster: click here
This article permanently updates the link address: