Important Sentinel options

At the previous post, I wrote about setting up Sentinel. This post explains some important options for a production system.

The following is a sample Sentinel config. (based on Redis 4.0.x)

protected-mode no port 5000
daemonize yes
pidfile "/home/tkstone/redis-4.0.6/redis_sentinel1.pid"
logfile "/home/tkstone/redis-4.0.6/logs/sentinel1.log"
loglevel notice
dir "/home/tkstone/redis-4.0.6/work"
sentinel monitor M1 127.0.0.1 6379 2
sentinel down-after-milliseconds M1 2000
sentinel failover-timeout M1 60000
sentinel parallel-syncs M1 2

You can check full documentation here.

sentinel monitor

format : sentinel monitor <master-name> <ip> <redis-port> <quorum>

  • master-name : master alias which is used as connection parameter for Jedis or Lettuce
  • ip : master ip
  • port : master port
  • quorum : mininum Sentinel instances to agree to decide that a master is down. For example, if sentinel count is 3, recommended quorum is 2 (to avoid split brain issue)
  • master ip and port changes automatically when Sentinel failover master Redis
  • You can set multi “sentinel monitor” for multi master configuration

sentinel down-after-milliseconds

Time in milliseconds after which Sentinel decides that a master is down if health check fails. Default is 30,000 (30 seconds), which means that if a master is down, failover happens only after 30 seconds. I think this period is too long for a production system. But if this value is too low, unwanted frequent failover can happen

sentinel failover-timeout

Failover itself can fail for some reason (i.e. no slaves are available) In that case, Sentinel tries fail over again after 2 times of failover-timeout (in milliseconds). Default is 3 minutes

sentinel parallel-syncs

If there are more than 2 slaves, this value limits parallel sync count

sentinel auth-pass

format : sentinel auth-pass <master-name> <master-password>

If a master is protected with password (using “requirepass”), this option must be set. If not, Sentinel fails to connect to the master

When a slave is promoted as a new master, Sentinel adds “requirepass” to the new master’s config file automatically

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.