MGR多主,此时这三台机器,均可读,可写
此时用keepalived 做写的切换,haproxy做读的负载
-
HAProxy 的配置文件(两台主机)如下
vi /usr/local/haproxy/haproxy.cfg
图解:这一部分清除掉
把下面的内容加上去
frontend mysql_mgr_deen1_front_write
bind *:3306
mode tcp
default_backend mysql_mgr_deen1_back_write
frontend mysql_mgr_deen1_front_read
bind *:3307
mode tcp
default_backend mysql_mgr_deen1_back_read
backend mysql_mgr_deen1_back_write
mode tcp
balance leastconn
option mysql-check user haproxy_check
server mysql51 192.168.0.51:3306 weight 1 check inter 2000 rise 2 fall 5 on-marked-up shutdown-backup-sessions
server mysql52 192.168.0.52:3306 weig