3

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
Nagama Inamdar
  • 2,851
  • 22
  • 39
  • 48
Learner
  • 315
  • 1
  • 5
  • 15

2 Answers2

1

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

Tw Bert
  • 3,659
  • 20
  • 28
  • Hi, thanks for your response. In exceptional cases like power failure or something, there is no way to know it before hand. Any suggestion for such situations? Thanks again. – Learner Mar 18 '14 at 07:45
  • Hi, np. Suggestion: please see my comment in [__this__](http://stackoverflow.com/questions/22208798/redis-replication-config/22329319#comment34022621_22329319) post. – Tw Bert Mar 18 '14 at 09:18
1

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