Lvs

lvs-tun 節點未連接

  • November 15, 2013

我正在使用隧道設置 LVS 集群。目標是擁有兩個導向器伺服器(在不同的數據中心)和一個真實伺服器(目前,稍後將在負載平衡中添加更多)。通過埠 80、443 和 8080 訪問真實伺服器

我已經成功配置了我的主控制器,它工作得很好,所有埠都打開了,數據流動良好

但是,備份導向器只能連接到埠 443 上的真實伺服器。這是我在 /var/log/messages 中得到的輸出:

Oct 27 12:25:20 vps4252 pulse[2819]: STARTING PULSE AS MASTER
Oct 27 12:25:38 vps4252 pulse[2819]: partner dead: activating lvs
Oct 27 12:25:38 vps4252 lvsd[2821]: starting virtual service https active: 443
Oct 27 12:25:38 vps4252 lvsd[2821]: create_monitor for https/node1 running as pid 2831
Oct 27 12:25:38 vps4252 lvsd[2821]: starting virtual service http_8080 active: 8080
Oct 27 12:25:38 vps4252 lvsd[2821]: create_monitor for http_8080/node1 running as pid 2833
Oct 27 12:25:38 vps4252 nanny[2831]: starting LVS client monitor for 103.13.xxx.xxx:443 -> 103.29.zzz.zzz:443
Oct 27 12:25:38 vps4252 nanny[2833]: starting LVS client monitor for 103.13.xxx.xxx:8080 -> 103.29.zzz.zzz:8080
Oct 27 12:25:38 vps4252 nanny[2831]: [ active ] making 103.29.zzz.zzz:443 available
Oct 27 12:25:43 vps4252 pulse[2823]: gratuitous lvs arps finished

(忽略缺少的埠 80 線,我當時禁用它進行測試)

似乎 nanny 程序只能連接到埠 443 上的真實伺服器。然而,使用 netcat 或 curl,我在其他 2 個埠上得到了正確的響應。

這是我的 lvs.cf(作為單個伺服器):

serial_no = 36
primary = 103.13.yyy.yyy
service = lvs
backup = 0.0.0.0
heartbeat = 1
heartbeat_port = 539
keepalive = 6
deadtime = 18
network = tunnel
debug_level = NONE
virtual http {
   active = 1
   address = 103.13.xxx.xxx eth0:1
   vip_nmask = 255.255.255.255
   port = 80
   send = "GET / HTTP/1.0\r\n\r\n"
   expect = "HTTP"
   use_regex = 0
   load_monitor = none
   scheduler = rr
   protocol = tcp
   timeout = 6
   reentry = 15
   quiesce_server = 0
   #Define nodes
   server node1 {
       address = 103.29.zzz.zzz
       active = 1
       port = 80
       weight = 1
   }
}
virtual https {
   active = 1
   address = 103.13.xxx.xxx eth0:1
   vip_nmask = 255.255.255.255
   port = 443
   send = "GET / HTTP/1.0\r\n\r\n"
   expect = "HTTP"
   use_regex = 0
   load_monitor = none
   scheduler = rr
   protocol = tcp
   timeout = 6
   reentry = 15
   quiesce_server = 0
   #Define nodes
   server node1 {
       address = 103.29.zzz.zzz
       active = 1
       port = 443
       weight = 1
   }
}
virtual http_8080 {
   active = 1
   address = 103.13.xxx.xxx eth0:1
   vip_nmask = 255.255.255.255
   port = 8080
   send = "GET / HTTP/1.0\r\n\r\n"
   expect = "HTTP"
   use_regex = 1
   protocol = tcp
   #Define nodes
   server node1 {
       address = 103.29.zzz.zzz
       active = 1
       port = 8080
       weight = 1
   }
}

真實伺服器上的隧道已經設置正確(畢竟443埠是工作的)

所以我被難住了……有沒有辦法強制節點處於活動狀態,即使nanny沒有找到它?

這是通過創建一個 bash 腳本來 ping 真實伺服器並從 lvs 配置文件中呼叫它來解決的

引用自:https://serverfault.com/questions/548986