90 Main <----------> 91 main
|
|
|
------------------------------
| |
| |
| |
92 from 93 from
Systemctl stop Firewalld.service; systemctl disable firewalld.service; Setenforce 0
Mysql-mmm
First, configure the master-slave synchronization structure
1) Configure Master-Slave synchronization
90: User Configuration Enable Binlog log Restart database service Specify primary database server information
91: User Configuration Enable Binlog log allow cascade replication Restart database service Specify primary database server information
[Email protected] ~]# VIM/ETC/MY.CNF
[Mysqld]
Validate_password_policy=0
Validate_password_length=6
server_id=91
Log-bin=master91
binlog_format= "Mixed"
Log_slave_updates
Grant Replication Slave on * * to [email protected] "%" identified by ' 123456 ';
Change Master to
master_host= "master server IP Address",
-master_user= "Authorized user name",
-master_password= "Authorized user password",
-master_log_file= "Binlog log that the primary server is using",
Master_log_pos= the current offset of the primary service;
#指定主服务器
2) Configure a master multi-slave structure
92: Specify server_id Restart database service to specify primary database server information
93: Specify server_id Restart database service to specify primary database server information
[Email protected] ~]# VIM/ETC/MY.CNF
[Mysqld]
Validate_password_policy=0
Validate_password_length=6
server_id=92
Change Master to
master_host= "master server IP Address",
-master_user= "Authorized user name",
-master_password= "Authorized user password",
-master_log_file= "Binlog log that the primary server is using",
Master_log_pos= the current offset of the primary service;
#指定主服务器
Mysql> Show Master Status\g;
mysql> start slave;
Mysql> show Slave status\g;
3) test master-Slave synchronization configuration on the client
A
Add user Guser on the 90 host to access the data and be able to have the same authorized user on the other 3 hosts
Grant Select on gamedb.* to [email protected] '% ' identified by ' 123456 ';
B
In the client host 94 using authorized user Guser to connect 14 servers, the resulting new data on his 3 hosts also have
Select User,host from Mysql.user where user= "Guser";
Second, the configuration mysql-mmm
1) mysql-mmm Introduction
Monitoring services: Running on the management node to monitor data nodes
Proxy service: Run on the data node to provide the system to the monitoring host
2) Install mysql-mmm Software on all hosts (90-94)
#yum-y Install perl-*
#unzip Mysql-mmm.zip
#cd mysql-mmm
#make Install
#ls/etc/mysql-mmm/*.conf
3) Modify the configuration file
A Modify Data Node Agent service profile (90 91 92 93)
Vim/etc/mysql-mmm/mmm_agent.conf
Include mmm_command.conf
This custom name
b Modify the configuration file for the Management node Monitoring service (94)
Vim/etc/mysql-mmm/mmm_mon.conf
>
Include mmm_common.conf
<monitor>
IP 192.168.4.94//natively IP
Pid_path/var/run/mmm_mond.pid
bin_path/usr/lib/mysql-mmm/
Status_path/var/lib/misc/mmm_mond.status
Ping_ips 192.168.4.90, 192.168.4.91, 192.168.4.92, 192.168.4.93//monitoring Server IP
</monitor>
Monitor_user theuser name used when monitor//monitoring status
Monitor_password 123456//The user password used when monitoring status
>
C Modifying public files
Vim/etc/mysql-mmm/mmm_command.conf
>
Active_master_role writer
Cluster_interface eth0
Pid_path/var/run/mmm_agentd.pid
bin_path/usr/lib/mysql-mmm/
Replication_user slaveuser//Set up master/slave sync user
Replication_password 123456//Set master/slave sync user password
Agent_user Agent//Control database user
Agent_password 123456//Control database user password
//Set up first primary server
IP 192.168.4.90
Mode Master
Peer db91//Designate another primary server
//Set up a second primary server
IP 192.168.4.91
Mode Master
Peer Db90
//Set slave server
IP 192.168.4.92
mode slave
//Set slave server
IP 192.168.4.93
mode slave
<role writer>//Specify Primary server VIP address
Hosts Db90, db91
IPs 192.168.4.100
Mode Exclusive
</role>
<role reader>//Specify the VIP address from the server
Hosts Db92, db93
IPs 192.168.4.101, 192.168.0.102
Mode Balanced
</role>
>
D add the corresponding authorized user on the data node host based on the configuration file settings
Grant replication Client on * * to [email protected] '% ' identified by ' 123456 ';
Grant Replication Client,process,super on * * to [email protected] '% ' identified by ' 123456 ';
Select User,host from Mysql.user where user in ("Monitor", "agent");
4) Start the service
A boot data node on the Host Agent service: Mmm_agent
Install service run dependent package install get VIP Address package arp_net start service
[[email protected] ~]#/etc/init.d/mysql-mmm-agent start
[Email protected] ~]# Netstat-pantu | grep 9989
b Start the monitoring service on the Management node host: Mmm_mond
Install service run dependent package start service
[[email protected] ~]#/etc/init.d/mysql-mmm-monitor start
[Email protected] ~]# Netstat-pantu | grep 9988
Third, verify the Mysql-mmm configuration
A view the database service on the database node is running
[Email protected] ~]# systemctl status mysqld
b io thread and SQL thread are all Yes states
Mysql> show Slave status\g;
C in the Monitoring Server native Login Management interface view, view the status of the database server
[Email protected] ~]# Mmm_control Show
Defined (@array) is deprecated at/usr/share/perl5/vendor_perl/log/log4perl/config.pm line 863.
(maybe you should just omit the defined ()?)
Db90 (192.168.4.90) master/awaiting_recovery. Roles:
Db91 (192.168.4.91) master/awaiting_recovery. Roles:
Db92 (192.168.4.92) slave/awaiting_recovery. Roles:
Db93 (192.168.4.93) slave/awaiting_recovery. Roles:
[Email protected] ~]# Mmm_control set_online db90
[Email protected] ~]# Mmm_control Show
Defined (@array) is deprecated at/usr/share/perl5/vendor_perl/log/log4perl/config.pm line 863.
(maybe you should just omit the defined ()?)
Db90 (192.168.4.90) master/online. Roles:writer (192.168.4.100)
Db91 (192.168.4.91) master/online. Roles:
Db92 (192.168.4.92) slave/online. Roles:reader (192.168.0.102)
Db93 (192.168.4.93) slave/online. Roles:reader (192.168.4.101)
[Email protected] ~]# Mmm_control Show
Defined (@array) is deprecated at/usr/share/perl5/vendor_perl/log/log4perl/config.pm line 863.
(maybe you should just omit the defined ()?)
Db90 (192.168.4.90) master/online. Roles:writer (192.168.4.100)
Db91 (192.168.4.91) master/hard_offline. Roles:
Db92 (192.168.4.92) slave/online. Roles:reader (192.168.0.102)
Db93 (192.168.4.93) slave/online. Roles:reader (192.168.4.101)
MYSQL-MMM Cluster deployment