我有一个简单的双主机 graylog 集群,我需要为其平衡 udp syslog 流量的负载,我正在使用 keepalived,浮动 ip 和负载平衡工作完美,但它仍然将流量引导到所有节点,即使是那些健康检查失败的节点,我希望它只将流量引导到健康的节点,这是我的 keepalived.conf:
global_defs {
enable_script_security
script_user root root
router_id LVS_MASTER
}
vrrp_instance VI_1 {
state MASTER
interface enp0s3
virtual_router_id 216
priority 200
advert_int 1
preempt_delay 30
authentication {
auth_type PASS
auth_pass redacted
}
virtual_ipaddress {
192.168.0.X
}
}
virtual_server 192.168.0.X 514 {
delay_loop 1
protocol UDP
lb_algo wrr # makes no difference
lb_kind NAT # no difference too
real_server 192.168.0.A 514 {
weight 1
HTTP_GET {
url {
path "/api/system/lbstatus"
status_code 200
}
connect_timeout 3
connect_port 9000
}
}
real_server 192.168.0.B 514 {
weight 1
HTTP_GET {
url {
path "/api/system/lbstatus"
status_code 200
}
connect_timeout 3
connect_port 9000
}
}
}
第二台主机上的情况相同,除了state BACKUP
优先级较低之外,两个 keepalived 实例都协作,我看到健康检查失败和成功,在日志中添加和删除 VS 等服务,但两台主机都接收数据,即使一台主机的健康检查失败(使用 tcpdump 验证)
我究竟做错了什么?