Build MySQL Cluster

Source: Internet
Author: User
Tags node server

First, build MySQL cluster
Cluster/cluster: A group of servers provide the same service

The following aspects only apply to the Ndbcluster storage engine, other types please bypass!!!!! ***

Roles of servers in a 1.mysql cluster
Data node (NDBD): Data stored in table
SQL node (SQL): User accesses data interface, executes SQL statement, does not store data
Management node (MGMD): Manage all hosts in the cluster
Client: Accessing Data

Approximate topology diagram:
Client (172.30.13.X)

MGM 193

SQL SQL NDBD NDBD
191 192 8 9

2. Process ideas:
(1). Install a package that provides the MySQL Cluster service on all hosts
(2). Write the corresponding configuration file for each role's host Config.ini MY.CNF

3, uninstall the MySQL database service software on all servers, here need to install a dedicated MySQL software, the main purpose is to avoid software conflicts
Service MySQL Stop
Rpm-qa | Grep-i MySQL
Rpm-e--nodeps mysql-server mysql-shared mysql-shared-compat mysql-embedded
Mysql-client Mysql-devel Mysql-test

Rm-rf/etc/my.cnf
ls/var/lib/mysql/
rm/var/lib/mysql/*

4. Install a package that provides cluster services on all servers
Mysql-cluster-gpl-7.3.3-1.el6.x86_64.rpm-bundle.tar

NDBD process (ndbd node) MySQL service (SQL node) MGMD process (Management node)

TAR-XVF Mysql-cluster-gpl-7.3.3-1.el6.x86_64.rpm-bundle.tar
RPM-UVH mysql-cluster-*.rpm
Rpm-qa | Grep-i "Mysql-cluster"


5. Configuration Management node (193)
Manage all the hosts in the cluster, run the management process, where you need to create a new Config.ini file on the Management node server, which defines the role and operating parameters of the set host;
(Load your own configuration Config.ini when starting the management process)
[NDBD Default] data node public configuration
[NDB_MGMD] Setting up a management host
[NDBD] Specifies the data node host
[mysqld] Specifying SQL node


Vim/etc/config.ini
[NDBD Default]
noofreplicas=2//Data node server count
datamemory=80m//Data cache
indexmemory=18m
[NDB_MGMD]
Nodeid=1//Management node number, range 1-50
hostname=172.30.13.193
Datadir=/var/log/mysql-cluster//Management Information storage directory
[NDBD]
Nodeid=8
hostname=172.30.13.8
Datadir=/var/log/mysql-cluster/data//Create on data node
[NDBD]
Nodeid=9
hostname=172.30.13.9
Datadir=/var/log/mysql-cluster/data
[Mysqld]
Nodeid=20
hostname=172.30.13. 191
[Mysqld]
Nodeid=30
hostname=172.30.13.192

Mkdir-p/var/log/mysql-cluster

6. Configuration Data Node (8, 9)
(Run NDBD process/etc/my.cnf)
Mkdir-p/var/log/mysql-cluster/data
Vim/etc/my.cnf
[Mysqld]
Datadir=/var/log/mysql-cluster/data
ndb-connectstring=172.30.13.193//Management host IP
Ndbcluster//Storage Engine
[Mysql_cluster]
ndb-connectstring=172.30.13.193//Who will manage the cluster


7. Configure the SQL node (191, 192)
(Running database service/etc/my.cnf)
Vim/etc/my.cnf
[Mysqld]
Ndbcluster
ndb-connectstring=172.30.13.193//Specify Management host
Default-storage-engine=ndbcluster
[Mysql_cluster]
ndb-connectstring=172.30.13.193


8. Start the corresponding process on each role host
(1 start the management process on the management host
Ndb_mgmd-f/etc/config.ini
Netstat-utnlap | grep:1186
NDB_MGM Login Management Interface Ndbcluster

(2 start the data process on the data node
[Email protected] data]# NDBD
2014-11-11 22:38:55 [NDBD] INFO--Angel connected to ' 172.30.13.193:1186 '
2014-11-11 22:38:55 [NDBD] INFO--Angel allocated Nodeid:8

(3) Start the MySQL service on the SQL node
Service MySQL Start
(4, set the authorization on the SQL node, verify in other clients
Cat/root/.mysql_secret
Mysql-uroot-pxxxxx
Mysql>grant all on * * to [e-mail protected] "%" identified by "123";


9. View the status of all hosts on the management node
Ndb_mgm
Show
(The experiment succeeds if the following appears)
Cluster Configuration
---------------------
[NDBD (NDB)] 2 node (s)
Id=28 @192.168.5.28 (mysql-5.6.14 ndb-7.3.3, nodegroup:0, *)
id=29 @192.168.5.29 (mysql-5.6.14 ndb-7.3.3, nodegroup:0)

[NDB_MGMD (MGM)] 1 node (s)
Id=1 @192.168.5.25 (mysql-5.6.14 ndb-7.3.3)

[Mysqld (API)] 2 node (s)
Id=26 @192.168.5.26 (mysql-5.6.14 ndb-7.3.3)
id=27 @192.168.5.27 (mysql-5.6.14 ndb-7.3.3)


This article is from the "Zhengerniu" blog, make sure to keep this source http://liufu1103.blog.51cto.com/9120722/1656836

Build MySQL Cluster

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.