jing1,jing2,jing3 是相同的操作
server_id=1 #这里在不同的虚拟机上需要修改gtid_mode=ONenforce_gtid_cOnsistency=ONlog_slave_updates=ONlog_bin=binlog
jing1上操作: jing2上操作【同jing3】:
CHANGE MASTER TOMASTER_HOST='172.25.1.101',MASTER_USER='zj',MASTER_PASSWORD='Westos+001',MASTER_AUTO_POSITION=1;
jing3上 操作:
在jing4上操作:
yum install -y mha4mysql-manager-0.58-0.el7.centos.noarch.rpm perl-* mha4mysql-node-0.58-0.el7.centos.noarch.rpm
在jing1,jing2,jing3上安装节点
[server default]manager_workdir=/etc/masterhamanager_log=/var/log/masterha.logmaster_binlog_dir=/etc/masterha#master_ip_failover_script= /usr/local/bin/master_ip_failover##master_ip_online_change_script= /usr/local/bin/master_ip_online_changepassword=Westos+001user=rootping_interval=1remote_workdir=/tmprepl_password=Westos+001repl_user=zj#report_script=/usr/local/send_report#secondary_check_script= /usr/local/bin/masterha_secondary_check -s server03 -s server02#shutdown_script=""ssh_user=root[server1]hostname=172.25.1.101port=3306[server2]hostname=172.25.1.102port=3306candidate_master=1check_repl_delay=0[server3]hostname=172.25.1.103port=3306no_master=1
在jing1上授权 在jing4 上操作:
nohup masterha_manager --cOnf=/etc/masterha/app1.cnf --remove_dead_master_conf --ignore_last_failover /var/log/masterha.log 2>&1 &
死切:
masterha_master_switch --master_state=dead --cOnf=/etc/masterha/app1.cnf --dead_master_host=172.25.1.101 --dead_master_ip=172.25.1.101 --dead_master_port=3306 --new_master_host=172.25.1.102 --new_master_port=3306
jing3查看 jing2查看: jing1重新启动,并设置: 活切:
masterha_master_switch --cOnf=/etc/masterha/app1.cnf --master_state=alive --new_master_host=172.25.1.101 --new_master_port=3306 --orig_master_is_new_slave --running_updates_limit=10000
切到jing1上: 查看jing2,jing3 ######################## vip飘移
打开脚本注释
############