Architecture:
192.168.188.101 (NDB mgmd node; SQL node 01) |
192.168.188.102 (SQL node 02) |
192.168.188.103 (ndbd node 01) |
192.168.188.104 (ndbd node 02) |
192.168.188.105 (LVS-01) |
192.168.188.106 (LVS-02) |
192.168.188.188 (web front end) |
First, NDB MGMD node
After installing CentOS 7.5.
1. Turn off SELinux and firewalls
Sed-i ' S#selinux=enforcing#selinux=disabled#g '/etc/selinux/config
Setenforce 0
Systemctl Stop Firewalld.service
Systemctl Disable Firewalld.service
=========================================================
2. Update the Yum Library
Yum-y Update
========================================
3. Download the MySQL installation package
wget https://downloads.mysql.com/archives/get/file/mysql-cluster-gpl-7.6.6-linux-glibc2.12-x86_64.tar.gz
Extract:
TAR-XVF mysql-cluster-gpl-7.6.6-linux-glibc2.12-x86_64.tar.gz
Cut files to/usr/local/mysql directory
MV Mysql-cluster-gpl-7.6.6-linux-glibc2.12-x86_64/usr/local/mysql
Create a MySQL cluster folder and create a configuration file
Mkdir-p/data/mysql/mysql-cluster
Cd/data/mysql/mysql-cluster
Vim MGMD.CNF
[NDBD Default] Noofreplicas=2datamemory=80mindexmemory=18m[ndb_mgmd]hostname=192.168.188.101datadir=/data/mysql/mysql-cluster [ndbd]hostname=192.168.188.103datadir=/usr/local/mysql/data[ndbd]hostname=192.168.188.104datadir=/usr/local/ MYSQL/DATA[MYSQLD]HOSTNAME=192.168.188.101[MYSQLD]HOSTNAME=192.168.188.102[MYSQLD]
Start MySQL cluster cluster
/usr/local/mysql/bin/ndb_mgmd-f mgmd.cnf
View process Status
[Email protected] mysql-cluster]# Ps-ef|grep mgmd|grep-v grep
Root 43958 1 0 19:28? 00:00:00/usr/local/mysql/bin/ndb_mgmd-f mgmd.cnf
[Email protected] mysql-cluster]#/USR/LOCAL/MYSQL/BIN/NDB_MGM 192.168.188.101
--NDB Cluster--Management Client--
Ndb_mgm> Show
Connected to Management Server at:192.168.188.101:1186
Cluster Configuration
---------------------
[NDBD (NDB)] 2 node (s)
id=2 (not connected, accepting connect from 192.168.188.103)
Id=3 (not connected, accepting connect from 192.168.188.104)
[NDB_MGMD (MGM)] 1 node (s)
Id=1 @192.168.188.101 (mysql-5.7.22 ndb-7.6.6)
[Mysqld (API)] 3 node (s)
Id=4 (not connected, accepting connect from 192.168.188.101)
Id=5 (not connected, accepting connect from 192.168.188.102)
Id=6 (not connected, accepting connect from any host)
Ndb_mgm>
Other SQL nodes and NDB nodes are not deployed, so the prompts are not connected;
Second, SQL node:
After installing CentOS 7.5.
1. Turn off SELinux and firewalls
Sed-i ' S#selinux=enforcing#selinux=disabled#g '/etc/selinux/config
Setenforce 0
Systemctl Stop Firewalld.service
Systemctl Disable Firewalld.service
=========================================================
2. Update the Yum Library
Yum-y Update
========================================
3. Download the MySQL installation package
wget https://downloads.mysql.com/archives/get/file/mysql-cluster-gpl-7.6.6-linux-glibc2.12-x86_64.tar.gz
Extract:
TAR-XVF mysql-cluster-gpl-7.6.6-linux-glibc2.12-x86_64.tar.gz
Cut files to/usr/local/mysql directory
MV Mysql-cluster-gpl-7.6.6-linux-glibc2.12-x86_64/usr/local/mysql
Create a Data folder and create a configuration file
Mkdir-p/usr/local/mysqldata
=======================================
configuring MySQL Files
Vim/etc/my.cnf
[client]socket=/usr/local/mysql/mysql.sock[mysqld]basedir=/usr/local/mysqldatadir=/usr/local/mysql/ Datandbclusterndb-connectstring=192.168.188.101 #管理节点ip [Mysql_cluster]ndb-connectstring=192.168.188.101 # Management node ipbind-address = 0.0.0.0
Initialize MySQL database:
Cd/usr/local/mysql
Groupadd MySQL
Useradd-r-G MySQL MySQL
Chown-r MySQL.
Chgrp-r MySQL.
Bin/mysqld--initialize--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data
Log the root password of the MySQL after initialization
A temporary password is generated for [email protected]: V:U-LSJ,J7NR
Change back to Authorization
[Email protected] mysql]# chown-r root.
[[email protected] mysql]# chown-r mysql data
Find the default Mysql.sock directory soft connection Custom Mysql.sock directory
Find/-name Mysql.sock
Ln-s/tmp/mysql.sock/usr/local/mysql/mysql.sock
adding system Startup Items
Cp/usr/local/mysql/support-files/mysql.server/etc/rc.d/init.d/mysql
chmod +x/etc/init.d/mysql
Chkconfig--add MySQL
Service MySQL Start
To add a global variable:
Vim/etc/profile
Path= $PATH:/usr/local/mysql:/usr/local/mysql/bin
Export PATH
Wq
Source/etc/profile
Service MySQL Restart
CD//usr/local/mysql/
bin/mysqladmin-uroot-p password ' 2285003 ' #修改密码
Mysql-u root-p #登录mysql
Many other units are also repeated configuration can be;
=========================================
Third, NDBD server deployment
After installing CentOS 7.5.
1. Turn off SELinux and firewalls
Sed-i ' S#selinux=enforcing#selinux=disabled#g '/etc/selinux/config
Setenforce 0
Systemctl Stop Firewalld.service
Systemctl Disable Firewalld.service
=========================================================
2. Update the Yum Library
Yum-y Update
========================================
3. Download the MySQL installation package
wget https://downloads.mysql.com/archives/get/file/mysql-cluster-gpl-7.6.6-linux-glibc2.12-x86_64.tar.gz
Extract:
TAR-XVF mysql-cluster-gpl-7.6.6-linux-glibc2.12-x86_64.tar.gz
Cut files to/usr/local/mysql directory
MV Mysql-cluster-gpl-7.6.6-linux-glibc2.12-x86_64/usr/local/mysql
Create a Data folder and create a configuration file
Mkdir-p/usr/local/mysqldata
Edit MySQL configuration file
[Email protected] ~]# VIM/ETC/MY.CNF
[Mysqld]ndbcluster #运行NDB存储引擎ndb-connectstring=192.168.188.101 #定位管理节点 [mysql_cluster]ndb-connectstring= 192.168.188.101 #定位管理节点
The first connection needs to add--initial after the successful connection, do not add this parameter;
/USR/LOCAL/MYSQL/BIN/NDBD--initial--ndb-connectstring=192.168.188.101
View process after successful connection
[Email protected] data]# Ps-ef | grep NBD
Root 43974 1272 0 20:11 pts/0 00:00:00 grep--color=auto NBD
Many other units are also repeated configuration can be;
============================================================================
Go back to the NDB-MGMD node to view the status:
[Email protected] ~]#/USR/LOCAL/MYSQL/BIN/NDB_MGM 192.168.188.101
--NDB Cluster--Management Client--
Ndb_mgm> Show
Connected to Management Server at:192.168.188.101:1186
Cluster Configuration
---------------------
[NDBD (NDB)] 2 node (s)
id=2 @192.168.188.103 (mysql-5.7.22 ndb-7.6.6, nodegroup:0, *)
Id=3 @192.168.188.104 (mysql-5.7.22 ndb-7.6.6, nodegroup:0)
[NDB_MGMD (MGM)] 1 node (s)
Id=1 @192.168.188.101 (mysql-5.7.22 ndb-7.6.6)
[Mysqld (API)] 3 node (s)
Id=4 (not connected, accepting connect from 192.168.188.101)
Id=5 (not connected, accepting connect from 192.168.188.102)
Id=6 @192.168.188.101 (mysql-5.7.22 ndb-7.6.6)
Ndb_mgm>
This completes the MySQL cluster NDB deployment, then complements the lvs+keepalive deployment;
Note: NDB high-availability clusters only support the tables created with the NDB engine in each node synchronization, the permissions of the SQL library is also independent, so also need to do after the cluster MySQL user rights synchronization;
centos7.5 deploying MySQL Cluster NDB summary