我正在使用隧道设置 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没有找到它?