To subscribe to Sentinel failover, what is the name of the Channel, and how do I detect that I need to refresh the master in the subscribed function?
I have a multi node Redis setup using Redis Sentinel for High Availability and failover.
I need to setup a Pub/Sub to Redis to detect when the Redis Master has failed and the system has elected a new Master.
_sentinel = redis.sentinel.Sentinel([(app.config["REDIS_HOSTNAME"],app.config["REDIS_SENTINEL_PORT"])])
_master = _sentinel.master_for(app.config["REDIS_SERVICE_NAME"])
def _sentinel_message_handler(message):
#TODO how do I detect that there is a new Redis Master?
_pubsub = _master.pubsub()
_pubsub.subscribe(**{app.config["TODO"]:_sentinel_message_handler})