Deploy a MySQL Cluster step by step in Linux ~ datablogs

Tuesday, July 21, 2015

Deploy a MySQL Cluster step by step in Linux

Before proceeding installation things , go through cluster basics from the MySQL website and forums. It will be helpful to easily understand installation and configuration. First time is difficult to get things to done in one shot is not possible , no problem will learn it .

MySQL Cluster Installation will be mostly done by two ways.,
  1. Using binaries
  2. rpm(Rethat,CentOS..,)
 Different Linux flavors has different methods to install format , here I have explaining with CentOS7 .

1.Have prepared two different machines to install MySQL Cluster . First you have to login two different machines

Two VM Machines
2.Be ready with mysql rpm's


3.Now get ready to start installation of MySQL Cluster

Create mysql user ...


4.Install downloaded Server and Client rpm's in both VM


5.MySQL Server needs to be install fully


6.Please verify cluster/mysql folder,once installation is completed




All files needs to be there , for MySQL Cluster you will get new database called ndbinfo .

7.This is time to create configuration file for mysql cluster environment

Only two configuration files needs to create for mysql cluster
  • my.cnf for mysql (SQL node)
  • config.ini for cluster 
Config.ini file for my cluster environment below
[ndbd default]
# Options affecting ndbd processes on all data nodes:
NoOfReplicas=2 # Number of replicas
#DataMemory=80M # How much memory to allocate for data storage
#IndexMemory=18M # How much memory to allocate for index storage
# For DataMemory and IndexMemory, we have used the
# default values. Since the "world" database takes up
# only about 500KB, this should be more than enough for
# this example Cluster setup.
#[tcp default]
# TCP/IP options:
# portnumber=2202 # This the default; however, you can use any
# port that is free for all the hosts in the cluster
# Note: It is recommended that you do not specify the port
# number at all and simply allow the default value to be used
# instead
[ndb_mgmd]
# Management process options:
NodeID=1
hostname=192.168.159.131 # Hostname or IP address of MGM node
[ndb_mgmd]
# Management process options:
NodeID=2
hostname=192.168.159.134 # Hostname or IP address of MGM node
[ndbd]
# Options for data node "A":
# (one [ndbd] section per data node)
NodeID=3
hostname=192.168.159.131 # Hostname or IP address
datadir=/var/lib/mysql-cluster/ # Directory for this data node's data files
[ndbd]
# Options for data node "B":
NodeID=4
hostname=192.168.159.134 # Hostname or IP address
datadir=/var/lib/mysql-cluster/ # Directory for this data node's data files
[mysqld]
# SQL node options:
NodeID=5
Same file you have to prepare and place in /var/lib/mysql-cluster directory . If any single word is missed cluster will not be start properly.

As per standalone mysql setup you have to prepare my.cnf file for SQL Node 

8.This is very important step you follow before you get into cluster environment

You have to start cluster as below.,
  1. Start management node in both mysqlone and mysqltwo 



     2.  Start data node in both mysqlone and mysqltwo



     3.  Start SQL node in both mysqlone and mysqltwo , after data node is up . If you start before data node might be crash.

 9.Now you have to check cluster status in any one of VM machine , using ndb_mgm utility


Once you start the data node , it will be in starting mode . Meanwhile you have to check howmuch data and index memory cluster is using as below.,


It will be start slowly never expect as much as you started , once data and management node start you will see like below.,


if data and index usage is above 90% you have to increase RAM memory and increase data memory , index memory parameter changes in config.ini file .

10.After you have to started Data node you will needs to start the SQL Node as said before


Once you started management,data and sql node in order wise . You ready with access high availability feature in MySQL .

Please contact me if you need further assistance on MySQL support , Thanks in advance .
Share:

0 comments:

Post a Comment