forked from spotahome/redis-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Monitor and heal master replica connections (#43)
When a RedisFailover's "master" Redis node is being replicated to a "slave" Redis node that is NOT part of the RedisFailover the redis-operator resets the sentinels indefinitely. Consider this scenario, the RedisFailover is being replicated asynchronously to a warm standby Redis cluster in a different data center to handle primary data site outages. Usually we'd configure the secondary site to replicate from the "slave" nodes of the Primary site's RedisFailover. However, if a failover occurs in the primary data site, it's possible that the "slave" to which the secondary site is connected to and replicating from is promoated to the Primary site's new master. When this happens, sentinel picks up the secondary site's replication connections and adds them to the list of replicas to consider for leader election. Thankfully, the operator prevents the sentinels from communicating with any pods that it ought NOT consider for leader election, so failovers still behave as expected. However, this causes the redis-operator to detect that the sentinels are trying to monitor replicas that they shouldn't and calls `SENTINEL RESET` to clear any stale replica entries form the sentinel. The secondary site is still replicating from the newly promoted master so the secondary site's replication connections are added back to the sentinel replicas list when the sentinel calls `INFO` on the primary site's "master"; repeating the reset cycle indefinitely. This change assumes that any replication not immediately meant to be managed by the RedisFailover should connect via the RedisFailover's "slave" nodes; the operator provides services to reach these nodes. When the operator detects that the master node has replication connections that would otherwise confuse the sentinel's leader election, it attempts to clean stale replication connections by resetting them; forcing replication clients to re-establish connections to a "slave" node in the primary site rather than the master.
- Loading branch information
1 parent
55611bc
commit 75824b3
Showing
12 changed files
with
250 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
mocks/operator/redisfailover/service/RedisFailoverCheck.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.