MySQL data Management 7
Deploy mysql highly clustered mysql-mmm + mysql master-slave synchronization
Environment preparation (four database servers 12 11 10 9)
Systemctl stop firewalld
Setenforce 0
Configure YUM Feed
Yum-y install gcc gcc-c++ perl-*
Systemctl start mysqld
+ +
Configure mysql master-slave synchronization (12 11 10 9)
9 and 10 are configured as the main main structure
12 and 11 slave database servers configured as 10
Requirement: the database tables created when the client accesses database server 9 are recorded at 11 and 12
You have to have it on the board, too.
User authorization:
1 users with synchronous data permissions (9 and 10)
Grant replication slave on *. * to slaveuser@ "%"
Identified by "123456"
Configure 9 and 10 as the main main structure
nine
Vim / etc/my.cnf
[mysqld]
Server_id=9
Log_bin=master9
Binlog_format= "mixed"
: wq
ten
Vim / etc/my.cnf
[mysqld]
Server_id=10
Log_bin=master10
Binlog_format= "mixed"
Log_slave_updates
: wq
nine
Mysql > change master to
Master_host= "192.168.4.10", master_user= "slaveuser"
Master_password= "123456", master_log_file= "master10
.000001 ", master_log_pos=154
Mysql > show slave status\ G
ten
Mysql > change master to
Master_host= "192.168.4.9", master_user= "slaveuser", m
Aster_password= "123456", master_log_file= "master9.00
0001 ", master_log_pos=154
Mysql > show slave status\ G
12 and 11 slave database servers configured as 10
eleven
Vim / etc/my.cnf
[mysqld]
Server_id=11
: wq
twelve
Vim / etc/my.cnf
[mysqld]
Server_id=12
: wq
11 and 12
Mysql > change master to
Master_host= "192.168.4.10", master_user= "slaveuser"
Master_password= "123456", master_log_file= "master10
.000001 ", master_log_pos=154
Mysql > show slave status\ G
Test the registration synchronization configuration:
nine
Mysql > create database gamedb
Mysql > grant all on gamedb.* to stu10@'% 'identified
By "123456"
two hundred and fifty four
Mysql-h292.168.4.9-ustu10-p123456 gamedb
Mysql > create table T1 (id int)
Mysql > insert into T1 values
You can view records and authorized users on the other three database servers
Select user,host from mysql.user where user= "stu10"
Select * from gamedb.t1
2. Configure mysql-mmm
Introduction of mysql-mmm Software
The mmm_monitor monitoring service runs on the monitoring side.
The mmm_agentd proxy service runs on the database server
Ip planning
Write the vip address 192.168.4.100 (9, 10)
Read the vip address 192.168.4.101Purple 102 (11,12)
Configure Monitoring Server 8
Systemctl stop firewalld
Setenforce 0
Configure YUM Feed
Yum-y install gcc gcc-c++ perl-*
Pack (12, 11, 10, 9, 8)
5 unzip mysql-mmm.zip
Cd mysql-mmm/
Tar-zxvf mysql-mmm-2.2.1.tar.gz
Cd mysql-mmm-2.2.1/
Make install
Profile description
Ls / etc/mysql-mmm/
Master profile for the mmm_mon.conf mmm_monitor monitoring service
Mmm_agent.conf mmm_agentd proxy service
Mmm_common.conf public files (monitoring server and database server
All have to have)
Modify the configuration file
1. Modify the master configuration of mmm_agentd proxy service on 4 database servers
File
Vim / etc/mysqlmmm/mmm_agent.conf
Include mmm_common.conf
This hostname # Custom
: wq
2 modify the main configuration file of the mmm_monitor monitoring service on the monitoring server
3 modify public files mmm_common.conf public files
4 on 4 database servers according to the mmm_common.conf configuration file
Add the corresponding authorized user to the settings of
Mysql > grant replication client on *. * to
Monitor@ "%" identified by "123456"
Mysql > grant replication client,process,super on *. * to
Agent@ "%" identified by "123456"
IV. Start the service
4.2 start the agnetd service on the database server
2 rpm-ivh perl-Log-Log4perl-1.26-1.el6.rf.noarch.rpm
4 tar-zxvf Algorithm-Diff-1.1902.tar.gz
6 cd Algorithm-Diff-1.1902/
8 perl Makefile.PL
9 make
10 make install
13 tar-zxvf Proc-Daemon-0.03.tar.gz
14 cd Proc-Daemon-0.03/
16 perl Makefile.PL
17 make
18 make install
21 gunzip Net-ARP-1.0.8.tgz
23 tar-xvf Net-ARP-1.0.8.tar
25 cd Net-ARP-1.0.8/
27 perl Makefile.PL
28 make
29 make install
31 / etc/init.d/mysql-mmm-agent status
32 / etc/init.d/mysql-mmm-agent start
33 netstat-utnalp | grep: 9989
Ls / var/log/mysql-mmm/mmm_agentd.log
4.3 start the monitor service on the monitoring server
2 rpm-ivh perl-Log-Log4perl-1.26-1.el6.rf.noarch.rpm
4 tar-zxvf Algorithm-Diff-1.1902.tar.gz
6 cd Algorithm-Diff-1.1902/
8 perl Makefile.PL
9 make
10 make install
13 tar-zxvf Proc-Daemon-0.03.tar.gz
14 cd Proc-Daemon-0.03/
16 perl Makefile.PL
17 make
18 make install
27 / etc/init.d/mysql-mmm-monitor status
28 / etc/init.d/mysql-mmm-monitor start
29 netstat-utnalp | grep: 9988
30 ls / var/log/mysql-mmm/mmm_mond.log
Log in to the management page of monitoring server 8 to view the status of the database server
# mmm_control help
# mmm_control show
# mmm_control set_online master9
# mmm_control set_online master10
# mmm_control set_online master11
# mmm_control set_online master12
# mmm_control show
View the acquired virtual ip address locally on the database server
# ip addr show | grep 192.168.4.100
Test configuration
254 client access
Ping 192.168.4.100
Mysql-h292.168.4.100-ustu10-p123456 gamedb