MySQL NDB 6.3.20 cluster installation and configuration towards high reliability

Source: Internet
Author: User

This article first introduces the MySQL cluster and then provides an installation process.

Introduction:

MySQL cluster is a technology that applies memory database clusters in a non-shared architecture system. This non-shared architecture can make the system use very inexpensive and minimum-configuration hardware.

A MySQL cluster is a distributed design designed to achieve zero point of failure. Therefore, any component should have its own memory and disk. Any shared storage solutions such as network sharing, network file systems and SAN devices are not recommended or supported. With this redundant design, MySQL claims that the data availability can reach 99. 999%.

In fact, a MySQL cluster integrates a memory Cluster Storage engine called NDB with a standard MySQL server. It contains a group of computers, each running one or more processes, which may include a MySQL server, a data node, a Management Server, and a proprietary data access program. Shows the relationship between them:

Install

Preparation:

Machines: Install Red Hat Linux AS 5 and disable the firewall.

Software: mysql-cluster-gpl-6.3.20-linux-i686-glibc23.tar.gz

IP Description
192.168.99.80 Management Node
192.168.99.88 SQL Node
192.168.99.89 Data Node
192.168.99.90 Data Node

The following IP addresses and purposes are allocated to the four machines:

The installation node has four machines and needs to be repeated four times:

 
 
  1. [root@candyshop ~]#groupadd mysql  
  2. [root@candyshop ~]#useradd –g mysql mysql  
  3. [root@candyshop ~]#tar zxvf mysql-cluster-gpl-6.3.20-linux-i686-glibc23.tar.gz  
  4. [root@candyshop ~]#chown mysql:mysql mysql-cluster-gpl-6.3.20-linux-i686-glibc23  
  5. [root@candyshop ~]#mv mysql-cluster-gpl-6.3.20-linux-i686-glibc23 /usr/local/mysql  

The preceding command first creates a mysql group and a mysql user, assigns mysql to the mysql group, decompress the installation file, and places it in the/usr/local/mysql directory.

Configuration

Configuration Management node [192.168.99.80]:

Create the following file/usr/local/mysql/cluster-conf/config. ini and place the following content:

 
 
  1. # Options affecting ndbd processes on all data nodes:  
  2. [ndbd default]  
  3. NoOfReplicas=2    # Number of replicas  
  4. DataMemory=80M    # How much memory to allocate for data storage  
  5. IndexMemory=18M   # How much memory to allocate for index storage  
  6.                   # For DataMemory and IndexMemory, we have used the  
  7.                   # default values. Since the "world" database takes up  
  8.                   # only about 500KB, this should be more than enough for  
  9.                   # this example Cluster setup.  
  10.    
  11. # Management process options:  
  12. [ndb_mgmd]  
  13. Id=1 
  14. Hostname=192.168.99.80           # Hostname or IP address of management node  
  15. Datadir=/usr/local/mysql/logs # Directory for management node log files  
  16.    
  17. # Options for data node "A":  
  18. [ndbd]  
  19. Id=2 
  20. Hostname=192.168.99.89           # Hostname or IP address  
  21. Datadir=/usr/local/mysql/ndbdata   # Directory for this data node's data files  
  22.    
  23. # Options for data node "B":  
  24. [ndbd]  
  25. Id=3 
  26. Hostname=192.168.99.90           # Hostname or IP address  
  27. Datadir=/usr/local/mysql/ndbdata   # Directory for this data node's data files  
  28.    
  29. # SQL node options:  
  30. [mysqld]  
  31. Id=4 
  32. Hostname=192.168.99.88           # Hostname or IP address  
  33.                                 # (additional mysqld connections can be  
  34.                                 # specified for this node for various  
  35.                                 # purposes such as running ndb_restore) 

In this file, IDs are assigned to the four nodes, which facilitates better management and differentiation of each node. Of course, if not specified, MySQL will also dynamically allocate one. The preceding Datadir files must be manually created if they do not exist. Run the mkdir-p command.

Configure the data node [192.168.99.89, 192.168.99.90]:

Create the/etc/my. cnf file with the following content:

 
 
  1. # Options for mysqld process:  
  2. [mysqld]  
  3. Datadir=/usr/local/mysql/ndbdata  
  4. ndbcluster                      # run NDB storage engine  
  5. ndb-connectstring=192.168.99.80 # location of management server  
  6.    
  7. # Options for ndbd process:  
  8. [mysql_cluster]  
  9. ndb-connectstring=192.168.99.80 # location of management server 

Configure the SQL node [192.168.99.88]

Create the/etc/my. cnf file with the following content:

 
 
  1. # Options for mysqld process:  
  2. [mysqld]  
  3. ndbcluster                      # run NDB storage engine  
  4. ndb-connectstring=192.168.99.80 # location of management server  
  5.    
  6. # Options for ndbd process:  
  7. [mysql_cluster]  
  8. ndb-connectstring=192.168.99.80 # location of management server  
 
 
  1. [root@server88 mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --ldata=/usr/local/mysql/data/  
  2. Installing MySQL system tables...  
  3. OK  
  4. Filling help tables...  
  5. OK  

By now, all configurations have been completed.

Start

Start the pipe node [192.168.99.80]:

 
 
  1. [root@candyshop mysql]# ./bin/ndb_mgmd -f cluster-conf/config.ini  
  2. [root@candyshop mysql]# ./bin/ndb_mgm  
  3. -- NDB Cluster -- Management Client --  
  4. ndb_mgm> show  
  5. Connected to Management Server at: 192.168.99.80:1186  
  6. Cluster Configuration  
  7. ---------------------  
  8. [ndbd(NDB)]     2 node(s)  
  9. id=2 (not connected, accepting connect from 192.168.99.89)  
  10. id=3 (not connected, accepting connect from 192.168.99.90)  
  11.    
  12. [ndb_mgmd(MGM)] 1 node(s)  
  13. id=1    @192.168.99.80 (mysql-5.1.30 ndb-6.3.20)  
  14.    
  15. [mysqld(API)]   1 node(s)  
  16. id=4 (not connected, accepting connect from 192.168.99.88)  

We can see that the status of the cluster has not been started, and the status is not connected.

 
 
  1. [root@candyshop mysql]# ./bin/ndb_mgmd -f cluster-conf/config.ini  
  2. [root@candyshop mysql]# ./bin/ndb_mgm  
  3. -- NDB Cluster -- Management Client --  
  4. ndb_mgm> show  
  5. Connected to Management Server at: 192.168.99.80:1186  
  6. Cluster Configuration  
  7. ---------------------  
  8. [ndbd(NDB)]     2 node(s)  
  9. id=2 (not connected, accepting connect from 192.168.99.89)  
  10. id=3 (not connected, accepting connect from 192.168.99.90)  
  11.    
  12. [ndb_mgmd(MGM)] 1 node(s)  
  13. id=1    @192.168.99.80 (mysql-5.1.30 ndb-6.3.20)  
  14.    
  15. [mysqld(API)]   1 node(s)  
  16. id=4 (not connected, accepting connect from 192.168.99.88)  

Start the data node [192.168.99.89, 192.168.99.90]:

 
 
  1. [root@server89 ~]#cd /usr/local/mysql  
  2. [root@server89 mysql]#./bin/ndbd  

Start the SQL node [192.168.99.88]:

 
 
  1. [root@server88 mysql]# ./bin/mysqld_safe &  

Now, all nodes have been started. Let's check the system status:

 
 
  1. ndb_mgm> show  
  2. Connected to Management Server at: localhost:1186  
  3. Cluster Configuration  
  4. ---------------------  
  5. [ndbd(NDB)]     2 node(s)  
  6. id=2    @192.168.99.89 (mysql-5.1.30 ndb-6.3.20, Nodegroup: 0, Master)  
  7. id=3    @192.168.99.90 (mysql-5.1.30 ndb-6.3.20, Nodegroup: 0)  
  8.    
  9. [ndb_mgmd(MGM)] 1 node(s)  
  10. id=1    @192.168.99.80 (mysql-5.1.30 ndb-6.3.20)  
  11.    
  12. [mysqld(API)]   1 node(s)  
  13. id=4    @192.168.99.88 (mysql-5.1.30 ndb-6.3.20)  

So far, the installation is complete

Edit recommendations]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.