gpt4 book ai didi

haproxy - Layer4 "Connection refused"带haproxy

转载 作者:行者123 更新时间:2023-12-04 00:36:45 28 4
gpt4 key购买 nike

我需要一些关于如何设置的建议 haproxy .我有两个网络服务器正在运行。为了测试,他们在端口 8080 上运行了一个简单的节点服务器。

现在在我的 haproxy 服务器上,我启动了 haproxy,它给了我以下内容:

$> /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg 
[WARNING] 325/202628 (16) : Server node-backend/server-a is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[WARNING] 325/202631 (16) : Server node-backend/server-b is DOWN, reason: Layer4 timeout, check duration: 2001ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 325/202631 (16) : backend 'node-backend' has no server available!

只有一个注意事项:如果我这样做:
haproxy$> wget server-a:8080

我从节点服务器得到响应。

这是我的 haproxy.cfg:
#---------------------------------------------------------------------  
# Global settings
#---------------------------------------------------------------------
global
log 127.0.0.1 local2

chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy

stats socket /var/lib/haproxy/stats

#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
mode tcp
log global
option tcplog
option dontlognull
option http-server-close
# option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000

#---------------------------------------------------------------------
# main frontend which proxys to the backends
#---------------------------------------------------------------------
frontend www
bind *:80
default_backend node-backend

#---------------------------------------------------------------------
# round robin balancing between the various backends
#--------------------------------------------------------------------
backend node-backend
balance roundrobin
mode tcp
server server-a 172.19.0.2:8080 check
server server-b 172.19.0.3:8080 check

如果我删除 check选项似乎有效。我有什么建议可以修复haproxy的这种检查机制吗?

最佳答案

您需要在命令的帮助下获取服务器的确切 IP 地址

ifconfig
并在您的 haproxy.cfg 中更正以下地址文件:
172.19.0.2:8080
172.19.0.3:8080
或修改如下行
server server-a server-a:8080 check
server server-b server-b:8080 check

关于haproxy - Layer4 "Connection refused"带haproxy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40729125/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com