Main objective to set up clustering MySQL would be to get redundancy – that you host and applications can run efficiently even if one machine goes .
Be aware: For better performance that you need to own a third server as a management node however this is sometimes shut down after the cluster commences. Additionally note that shutting down the direction server isn’t advocated (see the excess notes at the base of this document for more data ). You are unable to run a MySQL Cluster with only two Dedicated servers And have authentic redundancy.
It’s likely to establish the cluster on just two Dedicated Servers you aren’t going to get the capability to”eliminate” a server and also to allow the bunch to last as ordinary. With this you need a third host running the direction node.
Now below I had awarded that the case for three servers:
mysql1.domain.com – 192.168.0.1
mysql2.domain.com – 192.168.0.2
mysql3.domain.com – 192.168.0.3
Servers 1 and 2 are the two which find yourself”clustered”. This would be ideal for two servers behind a load balancer or with roundrobin DNS and is still a pretty great replacement for replication. Server 3 needs to possess only minor improvements made for it and also does NOT need a MySQL install. It is sometimes a low-end system and also can be carrying out other activities.
STAGE 1 ): Install MySQL on the first two servers:
Finish the following measures on both mysql1 and mysql2 ip booter:
C d /usr/local/
Chown -R mysql data
chgrp -R mysql.
cp support-files/mysql. Server /etc/rc. d/init. P /
chmod +x /etc/rc. d/init. d/mysql.
Do not start out MySQL yet.
Phase 2: Install and configure the management server
You want the following files out of the bin/ of this mysql listing: ndb_mgm and also ndb_mgmd. Down load the whole mysql-max tarball and extract them by your bin/ directory.
Mkdir / / usr/src/mysql-mgm
C d / / usr/src/mysql-mgm
Tar -zxvf mysql-max-4.1.9-pc-linux-gnu-i686.tar.gz
mv bin/ndb_mgmd .
At This Point you Must Establish the config file for this particular management:
Mkdir / / var/lib/mysql-cluster
vi [or emacs or some other editor] config.ini
Now, insert the following (altering the bits indicated):
Number Management Server
HostName=192.168.0.3 # the IP of THIS SERVER
# Storage Engines
HostName=192.168.0.1 Number the IP of the FIRST SERVER
HostName=192.168.0.2 Number the IP of the SECOND SERVER
No 2 MySQL Customers
# I personally leave this blank to Permit quick changes of their mysql customers;
# you can enter the hostnames of the above two servers here. I suggest you don t.
Now, start the management server
This could be the MySQL control machine, not management console. You must therefore not anticipate any outcome (we will initiate the console later).
STAGE 3: Configure the storage/SQL servers and begin MySQL
On Every One of the two storage/SQL servers (192.168.0.1 along with 192.168.0.2) enter the following (changing the bits just as appropriate):