Environment
CentOS6.4 _ 64
Network Configuration
192.168.10.167 OS-14
192.168.10.166 OS-13
192.168.10.151 OS-1
192.168.10.152 OS-2
192.168.10.153 OS-3
192.168.10.154 OS-4
192.168.10.155 OS-5
192.168.10.156 OS-6
Architecture and resource allocation
192.168.10.151 ==== cluster management (CMGM)
###################################
192.168.10.154 OS-4 |
192.168.10.152 OS-2 | |=== MySQLServer (SQL)
192.168.10.153 OS-3 |
###################################
192.168.10.155 OS-5 |
192.168.10.156 OS-6 | |=== Storage (NDB)
192.168.10.167 OS-14 |
192.168.10.166 OS-13 |
Error:
File/usr/share/mysql/ukrainian/errmsg. sys from install of MySQL-Cluster-server-gpl-7.2.12-1.rhel5.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
Solution:
Yum-y remove mysql-libs-5.1.66-2.el6_3.x86_64
Error:
[Root @ OS-13 ~] # Cd/usr/src/mysql/& rpm-ivh/usr/src/mysql/MySQL-Cluster-server-gpl-7.2.12-1.rhel5.x86_64.rpm
Error: Failed dependencies:
Libaio. so.1 () (64bit) is needed by MySQL-Cluster-server-gpl-7.2.12-1.rhel5.x86_64
Libaio. so.1 (LIBAIO_0.1) (64bit) is needed by MySQL-Cluster-server-gpl-7.2.12-1.rhel5.x86_64
Libaio. so.1 (LIBAIO_0.4) (64bit) is needed by MySQL-Cluster-server-gpl-7.2.12-1.rhel5.x86_64
Solution:
Yum install libaio
Error:
[Root @ OS-14 mysql] # rpm-ivh/usr/src/mysql/MySQL-Cluster-server-gpl-7.2.12-1.rhel5.x86_64.rpm.
Error: Failed dependencies:
/Usr/bin/perl is needed by MySQL-Cluster-server-gpl-7.2.12-1.rhel5.x86_64
Solution:
Yum-y install perl
Start installation (each node)
[Root @ OS-1 mysql] # rpm-ivh MySQL-Cluster-server-gpl-7.2.12-1.rhel5.x86_64.rpm
Preparing... ######################################## ### [100%]
1: mySQL-Cluster-server-gp ################################# ######### [1, 100%]
[Root @ OS-1 MySQLCluster] # mkdir/home/mysql & chown-R mysql. mysql/home/mysql
[Root @ OS-1 MySQLCluster] # vi mysqlcluster. ini
[Ndbd default]
NoOfReplicas = 2
DataMemory = 80 M
IndexMemory = 18 M
[Tcp default]
Portnumber = 2202
[Ndb_mgmd]
Hostname = 192.168.10.151
Datadir =/home/mysql
[Ndbd]
Hostname = 192.168.10.155
Datadir =/home/mysql
[Ndbd]
Hostname = 192.168.10.156
Datadir =/home/mysql
[Ndbd]
Hostname = 192.168.10.166
Datadir =/home/mysql
[Ndbd]
Hostname = 192.168.10.167
Datadir =/home/mysql
[Mysqld]
Hostname = 192.168.10.153
[Mysqld]
Hostname = 192.168.10.152
[Mysqld]
Hostname = 192.168.10.154
Configure NDBD storage nodes and SQL nodes
[Root @ OS-2 mysql] # vi/etc/my. cnf
[Client]
Socket =/tmp/mysql. sock
[Mysqld]
Ndbcluster
Datadir =/home/mysql
Socket =/tmp/mysql. sock
Ndb-connectstring = 192.168.10.151
Old_passwords = 1
[Mysql_cluster]
Ndb-connectstring = 192.168.10.151
Perform the following steps on the machine of each data node NDBD and SQL node:
Scripts/mysql_install_db -- user = mysql -- datadir =/home/mysql
Example:
[Root @ OS-2 mysql] # mysql_install_db -- user = mysql -- datadir =/home/mysql
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
Support-files/mysql. server to the right place for your system
Please remember to set a password for the MySQL root USER!
To do so, start the server, then issue the following commands:
/Usr/bin/mysqladmin-u root password 'new-password'
/Usr/bin/mysqladmin-u root-h OS-2 password 'new-password'
Alternatively you can run:
/Usr/bin/mysql_secure_installation
Which will also give you the option of removing the test
Databases and anonymous user created by default. This is
Stronugly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon:
Cd/usr;/usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
Mysql-test-run.pl for cd/usr/mysql-test; perl
Please report any problems with the/usr/bin/mysqlbug script!
Start Cluster
Note the startup sequence: first, the management node, then the NDBD node, and finally the SQL node.
Start CMGM
[Root @ OS-1 mysql-cluster] # ndb_mgmd-f/etc/MySQLCluster/mysqlcluster. ini
MySQL Cluster Management Server mysql-5.5.30 ndb-7.2.12
[Root @ OS-1 mysql-cluster] # ndb_mgm
-- NDB Cluster -- Management Client --
Ndb_mgm> show
Connected to Management Server at: localhost: 1186
Cluster Configuration
---------------------
[Ndbd (NDB)] 4 node (s)
Id = 2 (not connected, accepting connect from 192.168.10.155)
Id = 3 (not connected, accepting connect from 192.168.10.156)
Id = 4 (not connected, accepting connect from 192.168.10.166)
Id = 5 (not connected, accepting connect from 192.168.10.167)
[Ndb_mgmd (MGM)] 1 node (s)
Id = 1 @ 192.168.10.151 (mysql-5.5.30 ndb-7.2.12)
[Mysqld (API)] 3 node (s)
Id = 6 (not connected, accepting connect from 192.168.10.153)
Id = 7 (not connected, accepting connect from 192.168.10.152)
Id = 8 (not connected, accepting connect from 192.168.10.154)
Start the NDBD Node
[Root @ OS-6 mysql] # ndbd -- initial # initialize with initial at the first startup. In other cases, no options are added.
15:52:41 [ndbd] INFO -- Angel connected to '192. 168.10.151: 100'
2013-05-06 15:52:41 [ndbd] INFO -- Angel allocated nodeid: 3
Show on OS-1
Ndb_mgm> show
Cluster Configuration
---------------------
[Ndbd (NDB)] 4 node (s)
Id = 2 @ 192.168.10.155 (mysql-5.5.30 ndb-7.2.12, node group: 0, Master)
Id = 3 @ 192.168.10.156 (mysql-5.5.30, Nodegroup: 0)
Id = 4 @ 192.168.10.166 (mysql-5.5.30, Nodegroup: 1)
Id = 5 @ 192.168.10.167 (mysql-5.5.30, Nodegroup: 1)
[Ndb_mgmd (MGM)] 1 node (s)
Id = 1 @ 192.168.10.151 (mysql-5.5.30 ndb-7.2.12)
[Mysqld (API)] 3 node (s)
Id = 6 (not connected, accepting connect from 192.168.10.153)
Id = 7 (not connected, accepting connect from 192.168.10.154)
Id = 8 (not connected, accepting connect from 192.168.10.154)
Start an SQL Node
[Root @ OS-3 mysql] # mysqld_safe -- user = mysql &
[1] 2501
[Root @ OS-3 mysql] #130506 16:01:16 mysqld_safe Logging to '/home/mysql/os-3.err '.
130506 16:01:16 mysqld_safe Starting mysqld daemon with databases from/home/mysql
Ndb_mgm> show
Cluster Configuration
---------------------
[Ndbd (NDB)] 4 node (s)
Id = 2 @ 192.168.10.155 (mysql-5.5.30 ndb-7.2.12, node group: 0, Master)
Id = 3 @ 192.168.10.156 (mysql-5.5.30, Nodegroup: 0)
Id = 4 @ 192.168.10.166 (mysql-5.5.30, Nodegroup: 1)
Id = 5 @ 192.168.10.167 (mysql-5.5.30, Nodegroup: 1)
[Ndb_mgmd (MGM)] 1 node (s)
Id = 1 @ 192.168.10.151 (mysql-5.5.30 ndb-7.2.12)
[Mysqld (API)] 3 node (s)
Id = 6 @ 192.168.10.153 (mysql-5.5.30 ndb-7.2.12)
Id = 7 @ 192.168.10.152 (mysql-5.5.30 ndb-7.2.12)
Id = 8 @ 192.168.10.154 (mysql-5.5.30 ndb-7.2.12)
Test:
Test the mysql-uroot connection on sqlserver
Recommended reading:
MySQL Cluster backup and recovery
Create a Cluster environment using three MySQL clusters. DOC
MySQL Cluster7.2 online addition of data nodes has major drawbacks