LVS+nginx配置完成后访问VIP没有进行转发。

MASTER级配置:
! Configuration File for keepalived
global_defs {
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 100
priority 150
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.23.52.200
}
}
virtual_server 10.23.52.200 80{
delay_loop 6
lb_algo wrr
lb_kind DR
persistence_timeout 1
protocol TCP
real_server 10.23.52.113 80{
weight 1
TCP_CHECK {
connect_port 80
connect_timeout 3
nb_get_retry 3
delay_before_:retry 3
}
}
real_server 10.23.52.114 80{
weight 1
TCP_CHECK {
connect_port 80
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
}
查看监听情况:
[root@localhost keepalived]# ipvsadm -ln
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 10.23.52.200:80 wrr persistent 1
-> 10.23.52.113:80 Route 1 0 0
-> 10.23.52.114:80 Route 1 0 0
[root@localhost keepalived]#
查看日志:
[root@localhost keepalived]# tail -f /var/log/messages
Mar 6 10:31:25 localhost kernel: IPVS: [wrr] scheduler registered.
Mar 6 10:31:26 localhost Keepalived_vrrp: VRRP_Instance(VI_1) Transition to MASTER STATE
Mar 6 10:31:27 localhost Keepalived_vrrp: VRRP_Instance(VI_1) Entering MASTER STATE
Mar 6 10:31:27 localhost Keepalived_vrrp: VRRP_Instance(VI_1) setting protocol VIPs.
Mar 6 10:31:27 localhost Keepalived_vrrp: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 10.23.52.200
Mar 6 10:31:32 localhost Keepalived_vrrp: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 10.23.52.200
Mar 6 10:32:08 localhost Keepalived_healthcheckers: TCP connection to [10.23.52.113]:80 failed !!!
Mar 6 10:32:08 localhost Keepalived_healthcheckers: Removing service [10.23.52.113]:80 from VS [10.23.52.200]:80
Mar 6 10:32:20 localhost Keepalived_healthcheckers: TCP connection to [10.23.52.113]:80 success.
Mar 6 10:32:20 localhost Keepalived_healthcheckers: Adding service [10.23.52.113]:80 to VS [10.23.52.200]:80
访问真是IP:
[root@localhost keepalived]# curl 10.23.52.113
<!DOCTYPE html>


Welcome to nginx! body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; }

Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.我是113号机器


[root@localhost keepalived]#
访问VIP一直没有反应:
[root@localhost keepalived]# curl 10.23.52.200
curl: (7) couldn't connect to host
[root@localhost keepalived]#
...全文
1068 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wwys 2019-06-24
  • 打赏
  • 举报
回复
dr模式后端服务器配置了vip吗?
qq_31561153 2019-06-19
  • 打赏
  • 举报
回复
楼主好,监控的后端real server端口非80端口,有试过吗?我用了8080,就无法访问了。80端口试过,ok
  • 打赏
  • 举报
回复
怎么没人回复啊,自己顶!!
cqyy725 2017-03-06
  • 打赏
  • 举报
回复
global_defs { router_id LVS_DEVEL } vrrp_instance VI_1 { state MASTER interface ens32 virtual_router_id 51 priority 100 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 192.100.1.196 } } virtual_server 192.100.1.196 8080 { delay_loop 6 lb_algo rr lb_kind DR nat_mask 255.255.255.0 persistence_timeout 50 protocol TCP real_server 192.100.1.211 8080 { weight 1 TCP_CHECK{ connect_timeout 3 nb_get_retry 3 delay_before_retry 3 connect_port 8080 } } } }

23,217

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧