(MySQL cluster) install MySQLCluster on Linux (RedHat5.6)
MySQL Cluster installation on Linux (RedHat 5.6)
I. Environment Introduction
IP_Address
Port_No
Node_name
Service_name
Desc
192.168.56.101
3306
SQL node)
Mysqld
SQL node (API node)
192.168.56.101
2202
Data Node
Ndbd
Data Node
192.168.56.102
3306
SQL node)
Mysqld
SQL node (API node)
192.168.56.102
2202
Data Node
Ndbd
Data Node
192.168.56.103
1186
Mgmt Node
Ndb_mgmd
Management Node
2. Preparations
1) disable the firewall (operate on three servers)
[Root @ localhost ~] # Service iptables stop
Flushing firewall rules: [OK]
Setting chains to policy ACCEPT: filter [OK]
Unloading iptables modules: [OK]
[Root @ localhost local] # chkconfig iptables off
2) firewall is disabled by default (operate on three servers)
[Root @ localhost ~] # Chkconfig iptables off
3) add mysql users and groups (operate on three servers)
[Root @ localhost ~] # Groupadd mysql
[Root @ localhost ~] # Useradd-g mysql
4) Upload the Installation File (only on 192.168.56.101)
You can use FileZilla to upload installation files, such as the/tmp directory on Linux. The Installation File I am using is: mysql-cluster-gpl-7.1.10-linux-i686-glibc23.tar.gz
Iii. Install Mysql Cluster
1. Install data nodes and SQL nodes (you only need to operate on 192.168.56.101)
1) install the tar package
[Root @ localhost ~] # Cd/tmp
[Root @ localhost tmp] # tar-C/usr/local-zxvf mysql-cluster-gpl-7.1.10-linux-i686-glibc23.tar.gz
[Root @ localhost tmp] # ln-s/usr/local/mysql-cluster-gpl-7.1.10-linux-i686-glibc23 // usr/local/mysql
[Root @ localhost tmp] # cd/usr/local/mysql
[Root @ localhost mysql] # scripts/mysql_install_db -- usr = mysql
2) Authorization
[Root @ localhost mysql] # cd ..
[Root @ localhost local] # chown-R mysql
[Root @ localhost local] # chgrp-R mysql
3) Create and edit my. cnf, and enter the following content:
[Mysqld]
Ndbcluster
Ndb-connectstring = 192.168.56.103
[Mysql_cluster]
Ndb-connectstring = 192.168.56.103
2. Copy the/usr/local/mysql folder and/etc/my. cnf to 192.168.56.102.
[Root @ localhost local] # scp-r./mysql/* root@192.168.56.102:/usr/local/mysql
The authenticity of host' 192. 168.56.102 (192.168.56.102) 'can't be established.
RSA key fingerprint is 1f: 26: d9: 20: d1: 77: 47: bf: 3c: 7b: 64: 6d: 68: 0f: bb: 76.
Are you sure you want to continue connecting (yes/no )? Yes
Warning: Permanently added '192. 168.56.102 '(RSA) to the list of known hosts.
Root@192.168.56.102's password:
...........
[Root @ localhost local] # scp-r/etc/my. cnf root@192.168.56.102:/etc/
3. Copy the/usr/local/mysql folder to 192.168.56.103 (use the scp command)
[Root @ localhost local] # scp-r./mysql/* root@192.168.56.103:/usr/local/mysql
The authenticity of host' 192. 168.56.103 (192.168.56.103) 'can't be established.
RSA key fingerprint is 1f: 26: d9: 20: d1: 77: 47: bf: 3c: 7b: 64: 6d: 68: 0f: bb: 76.
Are you sure you want to continue connecting (yes/no )? Yes
Warning: Permanently added '192. 168.56.103 '(RSA) to the list of known hosts.
Root@192.168.56.103's password:
4. Authorize in 102 & 103
[Root @ localhost ~] # Cd/usr/local
[Root @ localhost local] # chown-R mysql
[Root @ localhost local] # chgrp-R mysql
5. Configure the management node (on 192.168.56.103)
[Root @ localhost mysql] # mkdir/var/lib/mysql-cluster
[Root @ localhost mysql] # chown-R mysql/var/lib/mysql-cluster
[Root @ localhost mysql] # chgrp-R mysql/var/lib/mysql-cluster
[Root @ localhost mysql] # cd/usr/local/mysql/
[Root @ localhost mysql] # vim config. ini
Enter the following content in config. ini.
[Ndbd default]
NoOfReplicas = 2 # Number of replicas
DataMemory = 80 M # How much memory to allocate for data storage
IndexMemory = 18 M # How much memory to allocate for index storage
[Tcp default]
Portnumber = 2202 # This the default; however, you can use any
[Ndb_mgmd]
Hostname = 192.168.56.103 # Hostname or IP address of MGM node
Datadir =/var/lib/mysql-cluster # Directory for MGM node log files
[Ndbd]
Hostname = 192.168.56.101 # Hostname or IP address
Datadir =/usr/local/mysql/data # Directory for this data node's data files
[Ndbd]
Hostname = 192.168.56.102 # Hostname or IP address
Datadir =/usr/local/mysql/data # Directory for this data node's data files
[Mysqld]
Hostname = 192.168.56.101 # Hostname or IP address
[Mysqld]
Hostname = 192.168.56.102 # Hostname or IP address
4. Start Mysql Cluster
1. Start the management node background service (on 192.168.56.103)
[Root @ localhost mysql] #/usr/local/mysql/bin/ndb_mgmd-f/usr/local/mysql/config. ini
2. Start the management node Management Service (on 192.168.56.103)
[Root @ localhost mysql] #/usr/local/mysql/bin/ndb_mgm
3. View Mysql Cluster configuration information (on 192.168.56.103)