k8s-redis-ha icon indicating copy to clipboard operation
k8s-redis-ha copied to clipboard

Redis Service should always point to redis master

Open Rastusik opened this issue 7 years ago • 2 comments

Hi,

would it be possible to create a mechanism, which would create a redis-master-server service which would always point only to the redis master?

I'm thinking about dynamic labels changing for each redis-server pod... only the master pod would have the redis-master: true label and the redis-master-service would have set its selector to redis-master: true

Rastusik avatar Aug 22 '17 11:08 Rastusik

This possibly looks like a good solution too https://stackoverflow.com/questions/29226725/how-should-applciation-using-active-passive-redundant-model-be-containerized-usi

Rastusik avatar Aug 22 '17 15:08 Rastusik

We use haproxy with custom healthcheck for that. But this could probably be simply implemented as a shell script for readiness probe:

    backend bk_redis
      option tcp-check
      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

gytisgreitai avatar Aug 23 '17 04:08 gytisgreitai