lvs keepalived 和nginx apache 同一台机器的时候转发出问题

以下是测试结果
http://zh.linuxvirtualserver.org/files/2.jpg

没有负载测试
http://zh.linuxvirtualserver.org/files/3.jpg

也不敢判断是不是lvs不能和web同一台机器就不行,尤其是我的nginx是请求本地apache 81端口,也会出现
502 Bad Gateway 错误,纠结中。。。。。

master配置
! Configuration File for keepalived

global_defs {
notification_email {
}

notification_email_from root@localhost
smtp_server localhost
smtp_connect_timeout 30
router_id 194
}

vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 50
priority 85
advert_int 1
authentication {
auth_type PASS
auth_pass 123456789
}
virtual_ipaddress {
192.168.2.52
}
}

virtual_server 192.168.2.52 80 {
delay_loop 6
lb_algo rr
lb_kind DR
protocol TCP
# persistence_timeout 120
real_server 192.168.2.192 80 {
weight 3
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
connectport 80
}
}
real_server 192.168.2.194 80 {
weight 3
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
connectport 80
}
}

}

BACKUP 配置
! Configuration File for keepalived

global_defs {
notification_email {
}

notification_email_from root@localhost
smtp_server localhost
smtp_connect_timeout 30
router_id 194
}

vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 50
priority 80
advert_int 1
authentication {
auth_type PASS
auth_pass 123456789
}
virtual_ipaddress {
192.168.2.52
}
}

virtual_server 192.168.2.52 80 {
delay_loop 6
lb_algo rr
lb_kind DR
protocol TCP
# persistence_timeout 120
real_server 192.168.2.192 80 {
weight 3
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
connectport 80
}
}
real_server 192.168.2.194 80 {
weight 3
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
connectport 80
}
}

}

附件大小
Image icon 2.jpg20.56 KB
Image icon 3.jpg12.35 KB

Forums:

randomness