2012-07-23 13:06:55 +00:00
|
|
|
# Example sentinel.conf
|
2012-07-23 10:54:52 +00:00
|
|
|
|
2012-07-25 13:52:26 +00:00
|
|
|
# port <sentinel-port>
|
|
|
|
# The port that this sentinel instance will run on
|
|
|
|
port 26379
|
|
|
|
|
2014-07-29 17:49:56 +00:00
|
|
|
# announce <ip>
|
|
|
|
# The IP that other sentinels use to connect to this sentinel instance
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
#
|
|
|
|
# sentinel announce 1.2.3.4
|
|
|
|
|
2014-05-12 08:46:25 +00:00
|
|
|
# dir <working-directory>
|
|
|
|
# Every long running process should have a well-defined working directory.
|
|
|
|
# For Redis Sentinel to chdir to /tmp at startup is the simplest thing
|
|
|
|
# for the process to don't interferer with administrative tasks such as
|
|
|
|
# unmounting filesystems.
|
|
|
|
dir /tmp
|
|
|
|
|
2012-07-25 14:33:37 +00:00
|
|
|
# sentinel monitor <master-name> <ip> <redis-port> <quorum>
|
|
|
|
#
|
2013-11-30 06:14:28 +00:00
|
|
|
# Tells Sentinel to monitor this master, and to consider it in O_DOWN
|
2012-07-25 13:52:26 +00:00
|
|
|
# (Objectively Down) state only if at least <quorum> sentinels agree.
|
2012-07-23 10:54:52 +00:00
|
|
|
#
|
2013-11-21 16:07:00 +00:00
|
|
|
# Note that whatever is the ODOWN quorum, a Sentinel will require to
|
|
|
|
# be elected by the majority of the known Sentinels in order to
|
|
|
|
# start a failover, so no failover can be performed in minority.
|
|
|
|
#
|
2014-05-26 08:17:12 +00:00
|
|
|
# Slaves are auto-discovered, so you don't need to specify slaves in
|
|
|
|
# any way. Sentinel itself will rewrite this configuration file adding
|
|
|
|
# the slaves using additional configuration options.
|
|
|
|
# Also note that the configuration file is rewritten when a
|
|
|
|
# slave is promoted to master.
|
|
|
|
#
|
2012-07-23 10:54:52 +00:00
|
|
|
# Note: master name should not include special characters or spaces.
|
|
|
|
# The valid charset is A-z 0-9 and the three characters ".-_".
|
|
|
|
sentinel monitor mymaster 127.0.0.1 6379 2
|
|
|
|
|
2012-09-26 16:59:54 +00:00
|
|
|
# sentinel auth-pass <master-name> <password>
|
|
|
|
#
|
|
|
|
# Set the password to use to authenticate with the master and slaves.
|
|
|
|
# Useful if there is a password set in the Redis instances to monitor.
|
|
|
|
#
|
|
|
|
# Note that the master password is also used for slaves, so it is not
|
|
|
|
# possible to set a different password in masters and slaves instances
|
|
|
|
# if you want to be able to monitor these instances with Sentinel.
|
|
|
|
#
|
|
|
|
# However you can have Redis instances without the authentication enabled
|
|
|
|
# mixed with Redis instances requiring the authentication (as long as the
|
|
|
|
# password set is the same for all the instances requiring the password) as
|
|
|
|
# the AUTH command will have no effect in Redis instances with authentication
|
|
|
|
# switched off.
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
#
|
|
|
|
# sentinel auth-pass mymaster MySUPER--secret-0123passw0rd
|
|
|
|
|
2012-07-25 14:33:37 +00:00
|
|
|
# sentinel down-after-milliseconds <master-name> <milliseconds>
|
|
|
|
#
|
2012-07-23 10:54:52 +00:00
|
|
|
# Number of milliseconds the master (or any attached slave or sentinel) should
|
|
|
|
# be unreachable (as in, not acceptable reply to PING, continuously, for the
|
|
|
|
# specified period) in order to consider it in S_DOWN state (Subjectively
|
|
|
|
# Down).
|
|
|
|
#
|
|
|
|
# Default is 30 seconds.
|
|
|
|
sentinel down-after-milliseconds mymaster 30000
|
|
|
|
|
2012-07-25 14:33:37 +00:00
|
|
|
# sentinel parallel-syncs <master-name> <numslaves>
|
|
|
|
#
|
2012-07-23 10:54:52 +00:00
|
|
|
# How many slaves we can reconfigure to point to the new slave simultaneously
|
|
|
|
# during the failover. Use a low number if you use the slaves to serve query
|
|
|
|
# to avoid that all the slaves will be unreachable at about the same
|
|
|
|
# time while performing the synchronization with the master.
|
|
|
|
sentinel parallel-syncs mymaster 1
|
|
|
|
|
2012-07-25 14:33:37 +00:00
|
|
|
# sentinel failover-timeout <master-name> <milliseconds>
|
|
|
|
#
|
2013-11-21 16:07:00 +00:00
|
|
|
# Specifies the failover timeout in milliseconds. It is used in many ways:
|
|
|
|
#
|
|
|
|
# - The time needed to re-start a failover after a previous failover was
|
|
|
|
# already tried against the same master by a given Sentinel, is two
|
|
|
|
# times the failover timeout.
|
|
|
|
#
|
|
|
|
# - The time needed for a slave replicating to a wrong master according
|
2013-11-30 06:14:28 +00:00
|
|
|
# to a Sentinel current configuration, to be forced to replicate
|
2013-11-21 16:07:00 +00:00
|
|
|
# with the right master, is exactly the failover timeout (counting since
|
|
|
|
# the moment a Sentinel detected the misconfiguration).
|
2012-07-23 10:54:52 +00:00
|
|
|
#
|
2013-11-21 16:07:00 +00:00
|
|
|
# - The time needed to cancel a failover that is already in progress but
|
|
|
|
# did not produced any configuration change (SLAVEOF NO ONE yet not
|
|
|
|
# acknowledged by the promoted slave).
|
2012-07-23 10:54:52 +00:00
|
|
|
#
|
2013-11-21 16:07:00 +00:00
|
|
|
# - The maximum time a failover in progress waits for all the slaves to be
|
|
|
|
# reconfigured as slaves of the new master. However even after this time
|
|
|
|
# the slaves will be reconfigured by the Sentinels anyway, but not with
|
|
|
|
# the exact parallel-syncs progression as specified.
|
|
|
|
#
|
|
|
|
# Default is 3 minutes.
|
|
|
|
sentinel failover-timeout mymaster 180000
|
2012-07-23 10:54:52 +00:00
|
|
|
|
2013-01-16 17:00:20 +00:00
|
|
|
# SCRIPTS EXECUTION
|
2012-07-31 09:05:21 +00:00
|
|
|
#
|
|
|
|
# sentinel notification-script and sentinel reconfig-script are used in order
|
|
|
|
# to configure scripts that are called to notify the system administrator
|
|
|
|
# or to reconfigure clients after a failover. The scripts are executed
|
|
|
|
# with the following rules for error handling:
|
|
|
|
#
|
2014-03-07 17:03:51 +00:00
|
|
|
# If script exits with "1" the execution is retried later (up to a maximum
|
2012-07-31 09:05:21 +00:00
|
|
|
# number of times currently set to 10).
|
|
|
|
#
|
2014-03-07 17:03:51 +00:00
|
|
|
# If script exits with "2" (or an higher value) the script execution is
|
2012-07-31 09:05:21 +00:00
|
|
|
# not retried.
|
|
|
|
#
|
|
|
|
# If script terminates because it receives a signal the behavior is the same
|
|
|
|
# as exit code 1.
|
|
|
|
#
|
|
|
|
# A script has a maximum running time of 60 seconds. After this limit is
|
|
|
|
# reached the script is terminated with a SIGKILL and the execution retried.
|
|
|
|
|
|
|
|
# NOTIFICATION SCRIPT
|
|
|
|
#
|
2012-07-25 14:33:37 +00:00
|
|
|
# sentinel notification-script <master-name> <script-path>
|
|
|
|
#
|
2013-11-30 06:14:28 +00:00
|
|
|
# Call the specified notification script for any sentinel event that is
|
2012-07-25 14:33:37 +00:00
|
|
|
# generated in the WARNING level (for instance -sdown, -odown, and so forth).
|
|
|
|
# This script should notify the system administrator via email, SMS, or any
|
|
|
|
# other messaging system, that there is something wrong with the monitored
|
|
|
|
# Redis systems.
|
|
|
|
#
|
|
|
|
# The script is called with just two arguments: the first is the event type
|
|
|
|
# and the second the event description.
|
|
|
|
#
|
2012-07-25 15:29:11 +00:00
|
|
|
# The script must exist and be executable in order for sentinel to start if
|
2012-07-25 14:33:37 +00:00
|
|
|
# this option is provided.
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
#
|
|
|
|
# sentinel notification-script mymaster /var/redis/notify.sh
|
|
|
|
|
2012-08-02 16:40:30 +00:00
|
|
|
# CLIENTS RECONFIGURATION SCRIPT
|
|
|
|
#
|
|
|
|
# sentinel client-reconfig-script <master-name> <script-path>
|
|
|
|
#
|
2013-11-21 16:07:00 +00:00
|
|
|
# When the master changed because of a failover a script can be called in
|
2012-08-02 16:40:30 +00:00
|
|
|
# order to perform application-specific tasks to notify the clients that the
|
|
|
|
# configuration has changed and the master is at a different address.
|
|
|
|
#
|
|
|
|
# The following arguments are passed to the script:
|
|
|
|
#
|
|
|
|
# <master-name> <role> <state> <from-ip> <from-port> <to-ip> <to-port>
|
|
|
|
#
|
2013-11-21 16:07:00 +00:00
|
|
|
# <state> is currently always "failover"
|
2012-08-02 16:40:30 +00:00
|
|
|
# <role> is either "leader" or "observer"
|
|
|
|
#
|
|
|
|
# The arguments from-ip, from-port, to-ip, to-port are used to communicate
|
|
|
|
# the old address of the master and the new address of the elected slave
|
2013-11-21 16:07:00 +00:00
|
|
|
# (now a master).
|
2012-08-02 16:40:30 +00:00
|
|
|
#
|
|
|
|
# This script should be resistant to multiple invocations.
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
#
|
|
|
|
# sentinel client-reconfig-script mymaster /var/redis/reconfig.sh
|
|
|
|
|
2012-07-25 14:33:37 +00:00
|
|
|
|