! 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 127.0.0.1
smtp_connect_timeout 30
router_id LVS_DEVEL
vrrp_skip_check_adv_addr
vrrp_garp_interval 0
vrrp_gna_interval 0 //vrrp_strict 这个存在不去掉的话 会导致ping不通,即ifconfig 和ipvsadm -ln 查看网卡和RS的配置是正确但是出现ping不通的情况
}
vrrp_instance VI_1 {
state MASTER
interface ens33
virtual_router_id 51 //路由编号
priority 100 //权重 ,主备的时候看这个 数值越大就先启用,最大则为主
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.59.100/24 dev ens33 label ens33:3 //配置的VIP,可以使用man 5 keepalived.conf查看相关信息
}
}
virtual_server 192.168.59.100 80 {
delay_loop 6
lb_algo rr
lb_kind DR //DR模型
nat_mask 255.255.255.0
persistence_timeout 0
protocol TCP
real_server 192.168.59.135 80 {
weight 1
HTTP_GET {
url {
path /
status_code 200
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
real_server 192.168.59.136 80 {
weight 1
HTTP_GET {
url {
path /
status_code 200
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
}