sanderploegsma / redis-cluster

Redis Cluster setup running on Kubernetes
https://sanderp.nl/running-redis-cluster-on-kubernetes-e451bda76cad
MIT License
246 stars 132 forks source link

statefulset failover IP change #6

Closed johnjavabean closed 5 years ago

johnjavabean commented 5 years ago

Hi there,

First thanks very much for contribute your solution for redis cluster which is super useful.

I just have a concern that statefulset only guarantees no change on domain of each node, however, the ip will still be changed. Will this break the cluster meet in cluster mode?

Thanks, Jiabin

riaan53 commented 5 years ago

Hi,

Redis cluster reconfigures the ip address automaticly when they detect changes. The redis container thats down must just point to a valid redis container when its back up. It will be best to run each statefulset on a seperate host. If everything goes down you have a problem and you will have to edit the nodes.conf file manually, but this should be rare.

Theres just one bug in redis that you need to manually hack around https://github.com/antirez/redis/issues/4645

Also if you are using the latest redis version, the cluster commands are now built into the redis-cli.

Hope this helps :)

Riaan Jacobs riaan53@gmail.com

sanderploegsma commented 5 years ago

Thanks for the response @riaan53, since Redis is no longer part of my day job I kind of stopped focusing on it. Great point on the cluster commands being integrated in Redis 5.0, I updated the repo to reflect it.

Running the pods on separate nodes is always a good idea, if a master and its slave live on the same VM and that goes down, you lose one of the shards. Using podAntiAffinity to make sure pods are not co-located is an easy way to solve this issue.