Eu tenho três servidores back-end load balanceados usando o HAProxy.
Quando todos os 3 deles estão ativos, vejo cada ID de servidores (1,2,3) consecutivamente na resposta HTTPS. IE 1,2,3,1,2,3. Como esperado.
No entanto, se eu derrubar um servidor back-end, só vejo um id de servidor repetidamente.
Ou seja, se eu derrubar o servidor 1, só vejo o id do servidor 2 (2,2,2,2 ...) quando eu deveria ver o id do servidor 2,3 (2,3,2,3,2,3 .....)
Eu tentei balancear tanto o lowconn quanto o round robin e ambos exibem o mesmo comportamento
Por que o HAProxy se comporta dessa maneira? Como faço para alterar minha configuração HAProxy para carregar o saldo entre os servidores back-end restantes?
A versão do proxy HA é 1.6.9. O servidor para o proxy HA é o Ubuntu 14.04.
O HTTP que está sendo exibido é uma API que retorna algum JSON por HTTPS. É uma API tranquila, portanto, não é necessária nem desejada persistência de sessão.
A configuração do haproxy está abaixo.
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
maxconn 3072
# Default SSL material locations
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
# Default ciphers to use on SSL-enabled listening sockets.
# For more information, see ciphers(1SSL). This list is from:
# https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
ssl-default-bind-ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:RC4-SHA:!kEDH$
ssl-default-bind-options no-sslv3
defaults
log global
mode http
option httplog
option dontlognull
option dontlog-normal
option redispatch
retries 3
maxconn 3072
timeout connect 5000
timeout client 10000
timeout server 10000
frontend apis-frontend
bind x.x.x.x:443 ssl verify none crt /etc/haproxy/xxx
mode http
option forwardfor
default_backend apis
backend apis
balance leastconn
mode http
option httpchk GET /
server 1 x.x.x.x:443 ssl verify none check
server 2 x.x.x.x:443 ssl verify none check
server 3 x.x.x.x:443 ssl verify none check
listen stats
bind *:8181
mode http
stats enable
stats uri /
stats realm Haproxy\ Statistics
stats auth xx
Editar: adicionou estatísticas.
pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,req_rate,req_rate_max,req_tot,cli_abrt,srv_abrt,comp_in,comp_out,comp_byp,comp_rsp,lastsess,last_chk,last_agt,qtime,ctime,rtime,ttime,
apis-frontend,FRONTEND,,,0,2,3072,24,9118,10021,0,0,19,,,,,OPEN,,,,,,,,,1,2,0,,,,0,0,0,4,,,,0,24,0,19,0,0,,0,6,43,,,0,0,0,0,,,,,,,,
apis,mt-wol-vlx-vps-01,0,0,0,1,,12,4863,3240,,0,,0,0,0,0,UP,1,1,0,1,0,12097,0,,1,3,1,,12,,2,0,,2,L7OK,200,36,0,12,0,0,0,0,0,,,,0,0,,,,,39,OK,,0,1,1,29,
apis,mt-lon-vlx-vps-01,0,0,0,1,,12,4255,3228,,0,,0,0,0,0,UP,1,1,0,0,0,12097,0,,1,3,2,,12,,2,0,,2,L7OK,200,23,0,12,0,0,0,0,0,,,,0,0,,,,,39,OK,,0,1,1,5,
apis,mt-cov-uks-vps-01,0,0,0,0,,0,0,0,,0,,0,0,0,0,DOWN,1,1,0,1,1,12094,12094,,1,3,3,,0,,2,0,,0,L4TOUT,,2001,0,0,0,0,0,0,0,,,,0,0,,,,,-1,,,0,0,0,0,
apis,BACKEND,0,0,0,1,308,24,9118,6468,0,0,,0,0,0,0,UP,2,2,0,,0,12097,0,,1,3,0,,24,,1,0,,3,,,,0,24,0,0,0,0,,,,,0,0,0,0,0,0,39,,,0,1,1,33,
stats,FRONTEND,,,1,4,3072,10,3811,169181,0,0,5,,,,,OPEN,,,,,,,,,1,4,0,,,,0,1,0,4,,,,0,9,0,5,0,0,,1,3,15,,,0,0,0,0,,,,,,,,
stats,BACKEND,0,0,0,0,308,0,3811,169181,0,0,,0,0,0,0,UP,0,0,0,,0,12097,0,,1,4,0,,0,,1,0,,0,,,,0,0,0,0,0,0,,,,,0,0,0,0,0,0,0,,,0,0,0,18,
editar: comportamento de balanceamento de carga em diferentes navegadores
Após uma solicitação para testar de um ip diferente. Eu notei a segunda carga de ip balanceada como esperado. Eu tentei do primeiro IP, mas usando diferentes navegadores borda e firefox. Equilíbrio de carga de borda e firefox conforme o esperado.
No entanto, o Chrome original do navegador ainda mantém um servidor back-end. Mesmo depois de fechar todas as janelas do Chrome e reiniciar o Chrome