Erros aleatórios HTTP 503 do HAProxy
Nós configuramos 3 servidores:
Servidor A com Nginx + HAproxy para realizar o balanceamento de cargaservidor backend Bservidor backend CAqui é o nosso/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
Todos os três servidores têm uma boa quantidade de núcleos de RAM e CPU para lidar com solicitações
Erros aleatórios HTTP 503 são mostrados ao navegar:503 Service Unavailable - No server is available to handle this request.
E também no console do servidor:
Message from syslogd@server-a at Dec 21 18:27:20 ...
haproxy[1650]: proxy Server-A has no server available!
Observe que 90% do tempo não há erros. Esses erros acontecem aleatoriamente.