Master_2: 192.168.1.144
VIP:192.168.1.151
Master_1:
Master_2:
Master_1
Master_2
MySQL configure
file on Master_1
MySQL
configure file on Master_2
Step 2: Check the master-slave running status on both side
Master_1:
Master_2:
Now the multiple master running well already, next we will install and configure the keepalived
yum install default path is /etc/keepalived/
Step 4: create MySQL notify down shell script on both nodes.
Step 6: vi /etc/keepalived/keepalived.conf and do keepalived configuration on master_2
Step 8: startup keepalived on master_2
Step 11: test keepalived failover
Keep ping the VIP through client side, and stop the keepalived service on master_1(192.168.1.200), see whether can failover to master_2(192.168.1.144)Master_1 stop keepalived service, log show VIP remove from 192.168.1.200 already.
Start keepalived on master_1 again, the VIP switch from master_2 to master_1
Step 12: Test MySQL failover
1: Stop mysql service on master_1, check VIP whether can failover to master_2Stop MySQL on master_1, log show keepalived service auto stopped on master_1
VIP
failover to Master_2 already.
2:start
mysql and keepalived service on master_1, see whether VIP switch to master_1
The
failover usually 3-5 seconds, when do switching, MySQL query will encounter error message.
The End
No comments:
Post a Comment