LikeLx 发表于 2015-10-28 17:16

keepalived+lvs访问VIP时连接全部为SYN_RECV状态

本帖最后由 LikeLx 于 2015-10-28 17:19 编辑

各位大神好:
      本人小白,第一次搞keepalived+lvs用于负载后端的nginx,VIP:10.206.10.200   realserver:10.206.10.8,10.206.10.9,为了不耽误大家的时间直接上配置文件。
这是主的配置文件,备的配置文件与之一样,主备切换功能是正常的。
! Configuration File for keepalived

global_defs {
   router_id ng_back
}
vrrp_script chk_http_port {
    script "/usr/local/nginx_check"
    interval 2
    weight 2
}

vrrp_instance VI_1 {
    state MASTER
    interface eth0
    virtual_router_id 200
    priority 101
    advert_int 1
    authentication {
      auth_type PASS
      auth_pass 1111
    }
    virtual_ipaddress {
      10.206.10.200
      10.206.10.201
    }
    notify_master /usr/local/backup.sh
    notify_fault/usr/local/error.sh
#    track_script {
#      chk_http_port
#      }
}

virtual_server 10.206.10.200 80 {   
      delay_loop 6   
      lb_algo rr   
      lb_kind DR   
      protocol TCP

real_server 10.206.10.8 80 {   
      weight 2   

      TCP_CHECK {   

         connect_timeout 3   

         nb_get_retry 3   

         delay_before_retry 1   

         connect_port 80   

                  }   

      }   

real_server 10.206.10.9 80 {   

      weight 2   

      TCP_CHECK {   

         connect_timeout 3   

         nb_get_retry 3   

         delay_before_retry 1   

         connect_port 80   

                  }   

      }   

}

我用主机访问时,负载的状态:

ipvsadm -lcn
IPVS connection entries
pro expire state       source             virtual            destination
TCP 00:55SYN_RECV    10.109.222.55:62499 10.206.10.200:80   10.206.10.8:80
TCP 00:55SYN_RECV    10.109.222.55:62498 10.206.10.200:80   10.206.10.9:80

ipvsadm -L
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port         Forward Weight ActiveConn InActConn
TCP10.206.10.200:http rr
-> 10.206.10.8:http             Route   2      0          1         
-> 10.206.10.9:http             Route   2      0          1   

ipvsadm -ln --stats
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port               Conns   InPktsOutPktsInBytes OutBytes
-> RemoteAddress:Port
TCP10.206.10.200:80                   10       26      0   1248      0
-> 10.206.10.8:80                      5       13      0      624      0
-> 10.206.10.9:80                      5       13      0      624      0

主机出现大量的SYN_RECV状态,web页面无法访问,单独访问web主机是可以正常访问的,请大神支招。

xiaoao133 发表于 2019-09-06 18:00

最近也在配置LVS有遇到一些问题,是否可以请教一下。
页: [1]
查看完整版本: keepalived+lvs访问VIP时连接全部为SYN_RECV状态