问题遇到的现象和发生背景
HA1:192.168.10.135
HA2:192.168.10.136
keepalived: VIP:192.168.10.200
real server1(本地):(HA1:192.168.10.135)
real server2:(HA2:192.168.10.136)
当停掉real server1后,其他主机(如:192.168.10.1)无法通过keepalived(192.168.10.200)访问real server2:(HA2:192.168.10.136)
只能在keepalived本地服务器(192.168.10.135)上访问real server2:(HA2:192.168.10.136)
问题相关代码,请勿粘贴截图
! Configuration File for keepalived
global_defs {
notification_email {
xlcocoon@foxmail.com
}
notification_email_from keepalived@showjoy.com
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_instance VI_1 {
#主机配MASTER,备机配BACKUP
state MASTER
#所在机器网卡
interface ens33
virtual_router_id 51
#数值越大优先级越高
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
#虚拟IP
192.168.10.200
}
}
virtual_server 192.168.10.200 48066 {
delay_loop 6
lb_algo rr
lb_kind NAT
persistence_timeout 50
protocol TCP
real_server 192.168.10.135 48066 {
weight 1
TCP_CHECK {
connect_timeout 3
retry 3
delay_before_retry 3
}
}
real_server 192.168.10.136 48600 {
weight 1
TCP_CHECK {
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
}
运行结果及报错内容
停止135上面的haproxy服务后
同网段其他主机通过200访问136报错
135本地keepalived通过VIP200访问136正常