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

Promote a slave to master when the master goes down in replication mode

Open C-Ravina opened this issue 1 year ago • 7 comments

In replication mode, when master goes down write operations couldn't be performed as slaves are read-only. So, when a slave is promoted to master in case of master failure then write operations won't be restricted. So, it would be nice, if code changes are made to promote a slave to master in case master goes down.

C-Ravina avatar Feb 14 '24 05:02 C-Ravina

Its a good feature addition on OT Redis. shall we implement this feature?

When there is a problem on master redis. We need to promote slave as Master. This will really help in all of our use case.

kannanvr avatar Feb 15 '24 05:02 kannanvr

HI @drivebyer ,

I think it could be a valuable addition to the project. Can we implement this feature?

C-Ravina avatar Feb 15 '24 05:02 C-Ravina

@C-Ravina Thank you for your feedback. If I understand your question correctly, I believe the feature you're referring to is already supported in this operator; it's the replication combined with sentinel mode. A sentinel cluster monitors the replication cluster and, in the event that the master goes down, the sentinel will promote a replica to master, thus ensuring read/write operations continuity.

drivebyer avatar Mar 07 '24 02:03 drivebyer

Hi @drivebyer , Thank you for your response. But why should it be like replication combined with sentinel mode and not simply replication with the ability to promote slave to master when master fails? Also, when I tried what you said earlier, I am able to set and get keys through the sentinel client (using sentinel service IP) and also through Redis client (using replication service IP). Is this behavior intended and why so?

C-Ravina avatar Mar 11 '24 12:03 C-Ravina

Thank you for your response. But why should it be like replication combined with sentinel mode and not simply replication with the ability to promote slave to master when master fails?

Providing high availability in replication mode initially would be more user-friendly.

Also, when I tried what you said earlier, I am able to set and get keys through the sentinel client (using sentinel service IP) and also through Redis client (using replication service IP). Is this behavior intended and why so?

I'm not sure which client you are using. When one uses go-redis, a sentinel client can be created with NewFailoverClient. This client issues the SENTINEL GET-MASTER-ADDR-BY-NAME command to retrieve the master's address, enabling it to execute set/get commands to the master.

drivebyer avatar Mar 11 '24 13:03 drivebyer