redis-operator icon indicating copy to clipboard operation
redis-operator copied to clipboard

Is is possible to Create a Redis Cluster with 2 Replicas

Open d80tb7 opened this issue 3 years ago • 5 comments

Hello,

I was trying to use the operator to have 2 followers per leader, i.e. a replication factor of 2, but couldn't find a way to achieve this. Is this possible with the operator?

many thanks,

Chris

d80tb7 avatar Dec 09 '21 11:12 d80tb7

I don't think this is possible within the current structure, do you have any thoughts on an API in terms of how your resource would look?

Something that comes to mind for myself was something like:

apiVersion: redis.redis.opstreelabs.in/v1beta1
kind: RedisCluster
metadata:
  name: redis-cluster
spec:
  redisLeader:
    size: 1
  redisFollower:
    replicationFactor: 2

Resulting in 1 Leader and 2 Followers, Increasing Leaders to 3 (for N+1) would result in 6 Leaders, where Leader%Follower would be used to determine the Leader in which the Follower would replicate from?

davidcollom avatar Jan 18 '22 18:01 davidcollom

I think just specifying the number of followers replicationFactor would be enough and keep using clusterSize to deploy the desired amount of leaders. Maybe something like this:

apiVersion: redis.redis.opstreelabs.in/v1beta1
kind: RedisCluster
metadata:
  name: redis-cluster
spec:
  clusterSize: 3 # Desired amount of leaders
  redisFollower:
    replicationFactor: 2 # Followers per leader

Could this be posible ?

Thanks

apena-pmy avatar Jan 31 '22 19:01 apena-pmy

I did initially think of something very similar and could work.

Something I did see as a possible issue was that right now there's a 1:1 on leader/follower, adding a factoring, there would have to be some kind of calculation to work out follower to leader.

Happy to look into this though, I've just not had much time to think about it in depth since initial response.

davidcollom avatar Jan 31 '22 20:01 davidcollom

This looks good. I'm going to request that you can go single leader and multiple replicas so you can have just HA and not the additional sharding that comes with adding multiple leaders.

bkrugerp99 avatar Apr 07 '22 21:04 bkrugerp99

Look for Redis Sentinel if you need Redis HA solution without sharding.

This looks good. I'm going to request that you can go single leader and multiple replicas so you can have just HA and not the additional sharding that comes with adding multiple leaders.

plachta11b avatar Apr 16 '22 18:04 plachta11b

Hi Based on this video I want to deploy 3 masters with 2 replicas to prevent split brain. Now is there any way to increase the replica to 2?

emahdij avatar Jan 12 '23 11:01 emahdij

https://github.com/OT-CONTAINER-KIT/redis-operator/pull/417

shubham-cmyk avatar Feb 05 '23 15:02 shubham-cmyk