0

I am trying implement the following setup

HA -|
    |- Redis1
    |- Redis2

At any time only one of the redis instances should serve the incoming requests.

Going by the documentation, it seems that you can disable a server dynamically and HA would stop directing the traffic to the disabled server. While this worked for new client connections, existing client connections are still served content from the disabled server. But if I kill the redis instance, even the existing client connections are redirected to the other instance.

Is it possible to achieve this behavior without killing the instance?

Heres my HA config:

global
    stats socket /opt/haproxy/admin.sock mode 660 level admin
    stats socket ipv4@*:19999 level admin

defaults
    log global
    mode tcp

listen myproxy
    mode tcp
    bind *:4444
    balance roundrobin
    server redis1 127.0.0.1:6379 check
    server redis2 127.0.0.1:7379 check
4

1 回答 1

2

找到了答案。需要添加以下指令:

on-marked-down shutdown-sessions

这将关闭所有现有会话。例如:

server redis1 127.0.0.1:6379 check on-marked-down shutdown-sessions
server redis2 127.0.0.1:7379 check on-marked-down shutdown-sessions
于 2017-09-18T17:09:31.450 回答