Redis
 sql >> Base de Dados >  >> NoSQL >> Redis

Como informar a um cliente onde o novo mestre Redis está usando o Sentinel


Você precisa se inscrever em mensagens sentinela em um de seus canais pubsub. Você pode ver no link que você postou que o sentinela publicará mensagens como
+odown <instance details> -- The specified instance is now in Objectively Down state.
-odown <instance details> -- The specified instance is no longer in Objectively Down state.
+failover-takedown <instance details> -- 25% of the configured failover timeout has elapsed, but this sentinel can't see any progress, and is the new leader. It starts to act as the new leader reconfiguring the remaining slaves to replicate with the new master.
+failover-triggered <instance details> -- We are starting a new failover as a the leader sentinel.

Então, quando você vê um sentinela publicar em um desses canais, você precisa analisar a mensagem e fazer com que seu cliente responda de acordo. O Redis não é inteligente - você precisa lidar com essas coisas usando uma biblioteca cliente.

Especificamente, os canais mais úteis são
+odown
+failover-detected
+switch-master