then the last blog post MySQL mha+keepalived scenario demo (iv) in the failover of MySQL, the current main library becomes the 192.168.2.129 machine, while the 129 machine on the keepalived service is turned on. However, 192.168.2.128 's original main library was hung, and the running keepalived was stopped.
Restart MySQL on the 192.168.2.128 machine,
Add MySQL on the 192.168.2.128 machine as the 192.168.2.129 new Main library slave from the library.
To view the failover logs on the 192.168.2.130 machine:
grep "MASTER_PASSWORD" /var/log/masterha/app1/manager.logSun Jul 1 17:04:32 2018 - [info] All other slaves should start replication from here. Statement should be: CHANGE MASTER TO MASTER_HOST=‘192.168.2.129‘, MASTER_PORT=3306, MASTER_LOG_FILE=‘mysql-bin.000003‘, MASTER_LOG_POS=154, MASTER_USER=‘repmha‘, MASTER_PASSWORD=‘xxx‘;
Directly log on to the 192.168.2.128 on the MySQL, execution (do not be redundant from the 129 machine dump data recovery to 128 of the machine such a way to do MySQL synchronization)
CHANGE MASTER TO MASTER_HOST=‘192.168.2.129‘, MASTER_PORT=3306, MASTER_LOG_FILE=‘mysql-bin.000003‘, MASTER_LOG_POS=154, MASTER_USER=‘repmha‘, MASTER_PASSWORD=‘123456‘; start slave;show master status\G
192.168.2.128 Source Main Library was successfully added as a 129 new main library for slave from the library.
Manually modify the monitor 192.168.2.130 configuration file app1.cnf
Now the configuration file is as follows:
[[email protected] ~]#
The modified configuration file is as follows:
[[email protected] ~]# cat /etc/masterha/app1.cnf[server default]manager_log=/var/log/masterha/app1/manager.logmanager_workdir=/var/log/masterha/app1.logmaster_binlog_dir=/data/mysql/logs/bin-logmaster_ip_failover_script=/usr/local/bin/master_ip_failovermaster_ip_online_change_script=/usr/local/bin/master_ip_online_changepassword=123456ping_interval=1remote_workdir=/tmprepl_password=123456repl_user=repmhareport_script=/usr/local/bin/send_reportsecondary_check_script=/usr/local/bin/masterha_secondary_check -s server02 -s server03 --user=root --master_host=server03 --master_ip=192.168.2.129 --master_port=3306shutdown_script=""ssh_port=10280ssh_user=rootuser=monitor[server1]hostname=192.168.2.129port=3306[server2]candidate_master=1check_repl_delay=0hostname=192.168.2.128port=3306[server3]hostname=192.168.2.130port=3306
Kill off the original monitoring process
[[email protected] app1]# ps -ef|grep perlroot 47458 40702 0 15:29 pts/3 00:00:00 perl /usr/local/bin/masterha_manager --conf=/etc/masterha/app1.cnf --remove_dead_master_conf --ignore_last_failoverroot 47604 40702 0 15:30 pts/3 00:00:00 grep perl[[email protected] app1]# kill -9 47458
Restart Masterha_manager
[[email protected] app1]# nohup masterha_manager --conf=/etc/masterha/app1.cnf --remove_dead_master_conf --ignore_last_failover < /dev/null > /var/log/masterha/app1/manager.log 2>&1 & [1] 47458
Here 128 original master MySQL successfully added as 129 new Main library slave from library
MySQL's mha+keepalived solution demo (v)