就喜欢你想打又打不着我的样子 2017-03-06 02:41 采纳率: 0%
浏览 5368
已结题

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]#

  • 写回答

1条回答 默认 最新

  • zqbnqsdsmd 2017-03-06 19:43
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)