mysql主主复制+keepalived 打造高可用mysql集群
! Configuration File for keepalivedglobal_defs {
notification_email {
acassen@firewall.loc
failover@firewall.loc
sysadmin@firewall.loc
}
notification_email_from Alexandre.Cassen@firewall.loc
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
state backup #两台配置此处均是BACKUP
interface eth0
virtual_router_id 51
priority 100 #优先级,另一台改为90
advert_int 1
nopreempt #不抢占,只在优先级高的机器上设置即可,优先级低的机器不设置
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.1.1.25
}
}
virtual_server 10.1.1.25 3306 {
delay_loop 6
lb_algo wrr
lb_kind DR
persistence_timeout 50 #会话保持时间
protocol TCP
real_server 10.1.1.20 3306 {
weight 3
notify_down /tmp/nimei.sh #检测到mysql服务挂了就执行这个脚本(脚本要自己写哈)
TCP_CHECK {
connect_timeout 10 #连接超时时间
nb_get_retry 3 #重连次数
delay_before_retry 3 #重连间隔时间
connect_port 3306 #健康检查端口
}
}
}
页:
[1]