Good day, everyone.
I'm using HAproxy in front of a redis sentinel cluster. If has worked very
well, but this morning I ran into a small problem. The sentinel cluster
elected a new master, and HAproxy correctly detected the change and updated
accordingly (new connections went to the correct server). However, one of our
client web applications kept the connection open to the old server (now a
slave), generating errors. I'm guessing it's due to keepalives.
Will 'option redispatch' correct this? If not, is there a preferred way to
close the connection and force the client to reconnect? It doesn't necessarily
have to be graceful, although that would be nice.
Pertinent config below.
-Jim
defaults
log global
mode tcp
option tcplog
option dontlognull
option clitcpka
option srvtcpka
timeout connect 5000
timeout client 3m
timeout server 120000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
frontend redisFE
bind *:6379
mode tcp
frontend redisFE
bind *:6379
mode tcp
maxconn 10240
default_backend redisBE
backend redisBE
mode tcp
option tcplog
balance source
option tcp-check
#tcp-check send AUTH\ foobar\r\n
#tcp-check expect +OK
tcp-check send PING\r\n
tcp-check expect string +PONG
tcp-check send info\ replication\r\n
tcp-check expect string role:master
tcp-check send QUIT\r\n
tcp-check expect string +OK
server redis-01 127.0.0.1:6379 maxconn 1024 check inter 1s
server redis-02 127.0.0.2:6379 maxconn 1024 check inter 1s
Ditronics, LLC email disclaimer:
This communication, including attachments, is intended only for the exclusive
use of addressee and may contain proprietary, confidential, or privileged
information. Any use, review, duplication, disclosure, dissemination, or
distribution is strictly prohibited. If you were not the intended recipient,
you have received this communication in error. Please notify sender immediately
by return e-mail, delete this communication, and destroy any copies.