A total of five computers, the division of labor as follows: 117 master,118 slave119 Mon
First configure primary master synchronization
Edit master115,116 configuration file
#mmmlog_bin=/daan/mysql/5.6/data/mysql-Bin.log Log_bin_index=/daan/mysql/5.6/data/mysql-Bin.log.index Relay_log=/daan/mysql/5.6/data/mysql-relay-bin Relay_log_index=/daan/mysql/5.6/data/mysql-relay-Bin.index expire_logs_days=Tenmax_binlog_size=100M log_slave_updates=1auto_increment_increment=2Auto_increment_offset=1#116配置2 #auto_increment_offset=2Bind-address =0.0.0.0? Restart MySQL? Login to MySQL for the the,117, 118 Add user to replicate Grant REPLICATION SLAVE on*. * To'Rep'@'192.168.14.%'Identified by'Rep'; FLUSH privileges; (If replication fails, give all privileges) in117, 118 test copy change MASTER to Master_host='192.168.14.115', master_port=3306, master_user='Rep', Master_password='Rep', master_log_file='mysql-bin.000003', master_log_pos=417; start slave;show slave status\g;115 on test copy 116reset slave;stop slave; Change MASTER to Master_host='192.168.14.116', master_port=3306, master_user='Rep', Master_password='Rep', master_log_file='mysql-bin.000001', master_log_pos=216; start slave;show slave status\g;show databases; 2 master, two from configuration. Change MASTER to Master_host='192.168.14.120', master_port=3306, master_user='Rep', Master_password='Rep', master_log_file='mysql-bin.000001', master_log_pos=216Note that the virtual IP of master is used
Install mmm download http: // mysql-mmm.org/downloads Install
the, -, -, -MySQL Assign permissions grant all privileges on*. * To'Monitor'@'192.168.14.%'Identified by'Monitor1'; GRANT all Privileges on*. * To'Agent'@'192.168.14.%'Identified by'Agent1'; GRANT all Privileges on*. * To'Rep'@'192.168.14.%'Identified by'Rep1'; FLUSH privileges;
All machines Open firewall 9989firewall-cmd--zone=public--add-port=9989/tcp--Permanentfirewall
" MMM Script owner " --shell/sbin/nologin MMMD
#所有机器VI/etc/mysql-mmm/mmm_common.conf (You can use commands to copy SCP after writing good one/etc/mysql-mmm/mmm_common.conf [email protected]192.168.14.116:/etc/mysql-mmm/mmm_common.confSCP/etc/mysql-mmm/mmm_agent.conf [email protected]192.168.14.116:/etc/mysql-mmm/mmm_agent.conf) active_master_role writercluster_interface Eth0pid_path/var/run/mmmd_agent.pid Bin_path/usr/lib/mysql-mmm/Replication_user Rep replication_password rep1 Agent_user agent Agent_password Agent1IP192.168.14.15Mode Master Peer DB2IP192.168.14.16Mode Master Peer db1IP192.168.14.17mode slaveIP192.168.14.18mode slavehosts DB1, DB2 IPs192.168.14.120Mode exclusive</role><role reader>hosts DB3, DB4 IPs192.168.14.121,192.168.14.122Mode Balanced</role>
#数据库15,/etc/mysql-mmm/ mmm_agent.confinclude mmm_ Common.confthis DB1 #各自修改
#监控机119VI/etc/mysql-mmm/mmm_mon.confinclude mmm_common.conf<monitor>IP127.0.0.1Pid_path/var/run/Mmmd_mon.pidport9989Bin_path/usr/lib/mysql-mmm/Status_path/var/lib/misc/mmmd_mon.status ping_ips192.168.14.15,192.168.14.16,192.168.14.17,192.168.14.18</monitor>monitor_user Monitor Monitor_password monitor1Debug0
All machine mounting modules all the way to the CPAN Proc::D aemon cpan Log::log4perl perl -mcpan-e shellinstall net::arp
#数据库机器启动代理/etc/init.d/mysql-mmm-agent start
#监控机启动监控 chmod /etc/mysql-mmm/* vi/etc/hosts Add the following line 192.168.14.115 db1192.168.14.116 db2192.168.14.117 DB3 start:/etc/init.d/mysql-mmm-monitor start
the , 116 increase the virtual IPadd thefollowing two lines manually in the Ifcfg-eth0 configuration file: IPADDR2=192.168. 14.120 PREFIX2=/etc/sysconfig/network-scripts/ifcfg-eth0nmcli Dev Connect eth0 monitoring Machine Execute command mmm_control showmmm_control set_online db1mmm_control set_online db2mmm_control set_online db3
MySQL MMM configuration