[root@Master01 ~]# vim /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
notification_email {
acassen@firewall.loc
failover@firewall.loc
sysadmin@firewall.loc
}
notification_email_from Alexandre.Cassen@firewall.loc
smtp_server 172.24.8.10
smtp_connect_timeout 30
router_id LVS_DEVEL
vrrp_skip_check_adv_addr
vrrp_strict
vrrp_garp_interval 0
vrrp_gna_interval 0
}
vrrp_instance HA_1 {
state BACKUP #在Master01和Master02上均配置为BACKUP
interface eth1
virtual_router_id 51
priority 100
advert_int 1
nopreempt #不抢占模式,只有优先级高的机器上设置即可,优先级低的机器可不设置
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
172.24.8.12
}
} virtual_server 172.24.8.12 3306 {
delay_loop 2
lb_algo wrr
lb_kind DR
persistence_timeout 60 #会话保持时间
protocol TCP
real_server 172.24.8.10 3306 {
weight 3
notify_down /root/shutdown.sh #检测到服务down后执行的脚本
TCP_CHECK {
connect_timeout 10 #连接超时时间
nb_get_retry 3 #重连次数
delay_before_retry 3 #重连间隔时间
connect_port 3306 #健康检查端口
}
}
}
04-19 13:13
查看更多