【发布时间】:2012-12-09 07:10:16
【问题描述】:
我们设置了 3 台服务器:
- 使用 Nginx + HAproxy 执行负载平衡的服务器 A
- 后端服务器 B
- 后端服务器C
这是我们的/etc/haproxy/haproxy.cfg:
global
log /dev/log local0
log 127.0.0.1 local1 notice
maxconn 40096
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
contimeout 50000
clitimeout 50000
srvtimeout 50000
stats enable
stats uri /lb?stats
stats realm Haproxy\ Statistics
stats auth admin:admin
listen statslb :5054 # choose different names for the 2 nodes
mode http
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /
stats auth admin:admin
listen Server-A 0.0.0.0:80
mode http
balance roundrobin
cookie JSESSIONID prefix
option httpchk HEAD /check.txt HTTP/1.0
server Server-B <server.ip>:80 cookie app1inst2 check inter 1000 rise 2 fall 2
server Server-C <server.ip>:80 cookie app1inst2 check inter 1000 rise 2 fall 3
三台服务器都有大量的 RAM 和 CPU 内核来处理请求
浏览时显示随机 HTTP 503 错误:503 Service Unavailable - No server is available to handle this request.
还有在服务器的控制台上:
Message from syslogd@server-a at Dec 21 18:27:20 ...
haproxy[1650]: proxy Server-A has no server available!
请注意,90% 的时间没有错误。这些错误是随机发生的。
【问题讨论】:
-
你找到答案了吗?我们有类似的东西。
-
找到答案...请接受答案。
标签: haproxy