Learner
Learner

Reputation: 315

To get a faster redis failover

I am working with two redis instances monitored by one sentinel. when the master goes down and there is a "+sdown", I run a notification-script where I promote the slave to master using the following command on its redis-client:

SLAVEOF NO ONE .

It works fine.

My question is, it takes around 10 secs for the slave to become master and the application to continue working again.

How can i reduce this time stamp?

below is the sentinel config::::

sentinel monitor mymaster 127.0.0.1 6379 1

sentinel down-after-milliseconds mymaster 5000

sentinel failover-timeout mymaster 900000

sentinel can-failover mymaster yes

sentinel parallel-syncs mymaster 1

sentinel notification-script mymaster /etc/init.d/config/script.sh

Upvotes: 3

Views: 4620

Answers (2)

NIKAN ghorbani
NIKAN ghorbani

Reputation: 41

Try reduce sentinel down-after-milliseconds mymaster and failover-timeout mymaster

Upvotes: 1

Tw Bert
Tw Bert

Reputation: 3809

This is not a direct answer to your question, but a description of a different setup that avoids the need for having a quick response (in some scenario's).

When we model a use case in UML, we never put the redis sentinel in the default flow. The sentinel is our guard for situations where unknown errors occor: the exceptional flow.

If we know beforehand if the client needs to connect to a different redis instance, we simply instruct the client to do so, using redis pub/sub (combined with low resolution polling, since pub/sub traffic is not guaranteed-delivery).

Kind regards, TW

Upvotes: 1

Related Questions