GitHub user yuzegao added a comment to the discussion: Kvrocks gracefully failover design proposal
@git-hulk @ethervoid The above proposal does not consider lossless failover in Redis Sentinel mode. When Redis uses the Redis Sentinel high-availability architecture, executing the SENTINEL failover <master-name> command does not guarantee data loss. Redis Sentinel simply uses INFO REPLICAION to ensure that a slave instance with the smallest offset gap is selected, and then executes the SLAVEOF NO ONE command. See the following timing diagram for details. <img width="1470" height="830" alt="image" src="https://github.com/user-attachments/assets/6ac7cbd6-9fa0-4c51-ab2f-e975c206225a" /> If manual failover commands for kvrocks are required to support data loss-free failover in both Redis Sentinel and cluster modes, modifications to the Redis Sentinel source code are unavoidable (directly modifying the behavior of the SLAVEOF NO ONE command may not be appropriate): 1. Implement the SLAVEOF NO ONE GRACEFUL command in kvrocks to ensure data consistency between the master and slave instances during a master-slave failover. 2. When executing the SENTINEL failover <master-name> command on a Redis Sentinel, if the master node is reachable, the SLAVEOF NO ONE GRACEFUL command is used to initiate a master-slave failover without data loss. 3. kvrocks implements the "CLUSTERX FAILOVER" command, which works with the kvrocks controller to reverse the master-slave roles. 4. The SLAVEOF NO ONE GRACEFUL and CLUSTERX FAILOVER commands are expected to maintain consistent internal interaction mechanisms within kvrocks. I am currently studying the Kvrocks source code to evaluate potential modifications. GitHub link: https://github.com/apache/kvrocks/discussions/3218#discussioncomment-14783511 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected]
