I. Environment server1: 192.85.1.5server2: 192.85.1.4server3: 192.85.1.9 II. Cluster solution 1. management node: server12. storage node: server2, server33. SQL node: server2, server33. download mysql-cluster-gpl-7.1.9a-linux-i686-glibc23.tar.gz and upload the file to the server, for example,/h
I. Environment
Server1: 192.85.1.5
Server2: 192.85.1.4
Server3: 192.85.1.9
Ii. Cluster Solution
1. Management node: server1
2. storage nodes: server2 and server3
3. SQL nodes: server2 and server3
Upload the file mysql-cluster-gpl-7.1.9a-linux-i686-glibc23.tar.gz to the server, such as/home/zichen /.
Iv. installation and configuration
Shell> sudo groupadd mysql
Shell> sudo useradd-g mysql
Shell> sudo cd/usr/local
Shell> sudo tar-xvf mysql-cluster-gpl-7.1.9a-linux-i686-glibc23.tar.gz
Shell> sudo ln-s mysql-cluster-gpl-7.1.9a-linux-i686-glibc23.tar.gz mysql # ln command to generate a symbolic link to this directory
Shell> cd mysql
Shell> sudo scripts/mysql_install_db -- user = mysql # mysql_install_db script, which is used by www.linuxidc.com to initialize the mysql database authorization table, where server access is allowed.
Shell> sudo chown-R root. # change all attributes of the file to the root user.
Shell> sudo chown-R mysql data # change all attributes of the data directory to mysql users
Shell> sudo chgrp-R mysql. # change the group attribute to the mysql group.
Configure my. cnf on Server 2 and Server 3
Sudo nano/etc/my. cnf
Add at the end:
Program code
[Mysqld]
Ndbcluster
Ndb-connectstring = 192.85.1.5
[MYSQL_CLUSTER]
Ndb-connectstring = 192.85.1.5
Configure on the Management node: server1: 192.85.1.5
Program code
# Mkdir-p/usr/local/mysql-cluster/
# Cd/usr/local/mysql-cluster
# Vim config. ini
[Ndbd default]
NoOfReplicas = 2
[Mysqld default]
[NDB_MGMD DEFAULT]
[Tcp default]
# Set a management node Server
[NDB_MGMD]
Hostname = 192.85.1.5
# Log storage directory on MGM
Datadir =/usr/local/mysql-cluster/
# Set storage node server (NDB node)
[NDBD]
Hostname = 192.85.1.4
Datadir =/var/lib/mysql-cluster
# Second NDB Node
[NDBD]
Hostname = 192.85.1.9
Datadir =/var/lib/mysql-cluster/
# Setting SQL node server [MYSQLD]
[MYSQLD]
In server2. Create the mysql-cluster directory on Server 3,
Sudo mkdir-p/var/lib/mysql-cluster
5. Start
1. Start management:
Server1: 192.85.1.5
Program code
#/Usr/local/mysql/bin/ndb_mgmd-f/usr/local/mysql-cluster/config. ini
2. Start the storage Node
Server2: 192.85.1.4
Server3: 192.85.1.9
Program code
#/Usr/local/mysql/bin/ndbd-initial (the config. ini of the first startup or management node changes)
#/Usr/local/mysql/bin/ndbd (use this line later)
3. Start an SQL Node
Server2: 192.85.1.4
Server3: 192.85.1.9
#/Usr/local/mysql/bin/mysqld_safe -- user = mysql &