Keepalived配置文件
Keepalived配置文件
! Configuration File for keepalived
global_defs {
notification_email {
wanghongwei-dev@qq.com
}
notification_email_from Alexandre.Cassen@firewall.loc
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_DEVEL # 用于标识不同的主机节点,可以不修改
}
vrrp_script check_running {
script "/usr/local/bin/check_running"
interval 10
fall 1
rise 1
weight 10
}
vrrp_instance VI_1 {
state MASTER # 定义初始状态,可以是MASTER或者BACKUP
interface ens33
virtual_router_id 51 # 主备节点必须配置相同的virtual_router_id,标识在同一个vrrp组取值范围0-255
priority 150 # 设置优先级,优先级高的会被竞选为MASTER
advert_int 1
nopreempt # 工作模式,nopreempt表示工作在非抢占模式,默认是抢占模式preempt
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.128.210 dev ens34
}
track_script {
check_running weight 20
}
}
virtual_server 192.168.128.210 80 {
delay_loop 6
lb_algo rr
lb_kind DR
nat_mask 255.255.255.0
persistence_timeout 50
protocol TCP
real_server 192.168.199.203 80 {
weight 1
TCP_CHECK {
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
connect_port 80
}
}
real_server 192.168.199.204 80 {
weight 1
TCP_CHECK {
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
connect_port 80
}
}
}
作者:wanghongwei
版权声明:本作品遵循<CC BY-NC-ND 4.0>版权协议,商业转载请联系作者获得授权,非商业转载请附上原文出处链接及本声明。