how to set up a MySQL Cluster

MySQL database administration questions.

how to set up a MySQL Cluster

Postby marian » Mon Dec 13, 2010 1:13 pm

Laurentiu Coica (claur member), wrote a nice document, in which he explains how to set up a MySQL Cluster,
on 2 hosts.

Hosts:

172.16.196.129 mysql-01.devel.local mysql-01 - MySQL Node 1
172.16.196.131 mysql-02.devel.local mysql-02 - MySQL Node 2
172.16.196.132 mysql-00.devel.local mysql-00 - MySQL Mgmt node

* On nodes A (mysql-01) and B (mysql-02), we install the following rpm packages:

[root@mysql-01 MySQL-Cluster]# ll
total 492791
-rwxrwxrwx 1 root root 241779137 Sep 28 12:36 mysql-cluster-gpl-7.1.5-linux-x86_64-glibc23.tar.gz
-rwxrwxrwx 1 root root 7642333 Sep 28 12:27 MySQL-Cluster-gpl-client-7.1.5-1.rhel5.x86_64.rpm
-rwxrwxrwx 1 root root 1321045 Sep 28 12:27 MySQL-Cluster-gpl-clusterj-7.1.5-1.rhel5.x86_64.rpm
-rwxrwxrwx 1 root root 119672546 Sep 28 12:27 MySQL-Cluster-gpl-debuginfo-7.1.5-1.rhel5.x86_64.rpm
-rwxrwxrwx 1 root root 15983181 Sep 28 12:27 MySQL-Cluster-gpl-devel-7.1.5-1.rhel5.x86_64.rpm
-rwxrwxrwx 1 root root 51149464 Sep 28 12:27 MySQL-Cluster-gpl-embedded-7.1.5-1.rhel5.x86_64.rpm
-rwxrwxrwx 1 root root 4439380 Sep 28 12:28 MySQL-Cluster-gpl-extra-7.1.5-1.rhel5.x86_64.rpm
-rwxrwxrwx 1 root root 1352645 Sep 28 12:28 MySQL-Cluster-gpl-management-7.1.5-1.rhel5.x86_64.rpm
-rwxrwxrwx 1 root root 23118835 Sep 28 12:28 MySQL-Cluster-gpl-server-7.1.5-1.rhel5.x86_64.rpm
-rwxrwxrwx 1 root root 3333268 Sep 28 12:28 MySQL-Cluster-gpl-shared-7.1.5-1.rhel5.x86_64.rpm
-rwxrwxrwx 1 root root 4126062 Sep 28 12:28 MySQL-Cluster-gpl-storage-7.1.5-1.rhel5.x86_64.rpm
-rwxrwxrwx 1 root root 17031427 Sep 28 12:29 MySQL-Cluster-gpl-test-7.1.5-1.rhel5.x86_64.rpm
-rwxrwxrwx 1 root root 11673487 Sep 28 12:29 MySQL-Cluster-gpl-tools-7.1.5-1.rhel5.x86_64.rpm

[root@mysql-01 MySQL-Cluster]# rpm -ivh MySQL-Cluster-gpl-client-7.1.5-1.rhel5.x86_64.rpm \
MySQL-Cluster-gpl-extra-7.1.5-1.rhel5.x86_64.rpm \
MySQL-Cluster-gpl-server-7.1.5-1.rhel5.x86_64.rpm \
MySQL-Cluster-gpl-shared-7.1.5-1.rhel5.x86_64.rpm \
MySQL-Cluster-gpl-storage-7.1.5-1.rhel5.x86_64.rpm \
MySQL-Cluster-gpl-test-7.1.5-1.rhel5.x86_64.rpm \
MySQL-Cluster-gpl-tools-7.1.5-1.rhel5.x86_64.rpm \
MySQL-Cluster-gpl-clusterj-7.1.5-1.rhel5.x86_64.rpm

Preparing... ########################################### [100%]
1:MySQL-Cluster-gpl-clien########################################### [ 13%]
2:MySQL-Cluster-gpl-extra########################################### [ 25%]
3:MySQL-Cluster-gpl-serve########################################### [ 50%]

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 mysql-01.devel.local 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
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!

4:MySQL-Cluster-gpl-share########################################### [ 63%]
5:MySQL-Cluster-gpl-stora########################################### [ 75%]
6:MySQL-Cluster-gpl-test ########################################### [ 88%]
7:MySQL-Cluster-gpl-tools########################################### [100%]
8:MySQL-Cluster-gpl-clust########################################### [100%]


* On node mysql-00 we install :

[root@mysql-00 MySQL-Cluster]# rpm -ivh MySQL-Cluster-gpl-management-7.1.5-1.rhel5.x86_64.rpm \
MySQL-Cluster-gpl-tools-7.1.5-1.rhel5.x86_64.rpm

1:MySQL-Cluster-gpl-manag########################################### [ 50%]
2:MySQL-Cluster-gpl-tools########################################### [100%]

[root@mysql-00 MySQL-Cluster]#

* On nodes mysql-01 and mysql-02 we create file /etc/my.cnf, having:

[root@mysql-01 lib]# cat /etc/my.cnf
[mysqld]
ndbcluster
datadir=/var/lib/mysql
ndb-connectstring=172.16.196.132

[mysql_cluster]
ndb-connectstring=172.16.196.132

* We initialize the mysq instances from the nodes mysql-01 and mysql-02, using:

[root@mysql-01 lib]# mysql_install_db --user=mysql
Installing MySQL system tables...
OK