I configured an HAProxy service for my Redis Cluster installation (3 nodes with Redis Sentinel managing the master delegation) and it works good: clients are redirected only to the master node and whenever a slave node becomes master, HAProxy suddenly change the active member into the backend.
Just wanting to be meticulous, the slave nodes are shown as "DOWN" (red colour) into the HAProxy Statistics Report (Layer7 timeout: at step 5 of tcp-check (expect string 'role:master')). Is there a way to have them shown as "backup UP" (blue colour), which is the correct definition?
This because red nodes seems to be a problem, but this is not true as slave members are UP but they are just slave so they are not active. I think this is the correct definition of the "backup UP" state into HAProxy.
This is the configuration of HAProxy:
frontend Redis
bind 192.168.70.90:6379 name 192.168.70.90:6379
mode tcp
log global
timeout client 30000
default_backend Redis_tcp_ipvANY
backend Redis_tcp_ipvANY
mode tcp
timeout connect 30000
timeout server 30000
retries 3
option tcp-check
tcp-check connect
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 redis1 192.168.70.91:6379 check inter 1000 maxconn 1024
server redis2 192.168.70.92:6379 check inter 1000 maxconn 1024
server redis3 192.168.70.93:6379 check inter 1000 maxconn 1024
Do you have any idea about how it's possible to do what I want?
Thanks!
It's possible, but as you have more than two nodes, IT WON'T FAIL OVER CORRECTLY. But since you asked:
The haproxy
BACKUP
state simply means the server won't be considered for load-balancing as long as any normal server isUP
. Your present setup is better, I think.