Additional Configuration for Redis Sentinel

The following additional configuration is required for Redis Sentinel.

In Redis, you need to specify a Redis master and as many Redis replicas as you require. An odd number of Redis Sentinel is required to make a quorum.

The following is an example of how to start and configure a Redis Sentinel that has a master on port 6741, 1 replica on port 6742 and 3 sentinels on ports 6800, 6801, and 6802.

To start the Redis master, on a command prompt, type:

redis-server.exe --port 6741 --protected-mode no --bind 0.0.0.0

To start the Redis replica, on a command prompt, type:

redis-server.exe redis_replica.conf

To start the 3 Redis sentinels, on a command prompt, type:

redis-server.exe sentinel-1.conf –-sentinel
redis-server.exe sentinel-2.conf –-sentinel
redis-server.exe sentinel-3.conf –-sentinel

In this case, your Redis master will be called MY_MASTER, this needs to be in uppercase. The following is an example of the content for the redis_replica.conf file. In the following configuration files, ensure that the text in bold is modified to reflect your requirements:

bind 0.0.0.0
port 6742   ## The port used by the replica.
tcp-backlog 511 
timeout 0 
tcp-keepalive 0 
loglevel notice 
logfile "" 
databases 16 
save 900 1 
save 300 10 
save 60 10000 
stop-writes-on-bgsave-error yes 
rdbcompression yes 
rdbchecksum yes 
dbfilename "dump.rdb" 
replicaof 127.0.0.1 6741    ## The port and IP used by the master
replica-serve-stale-data yes 
replica-read-only yes 
repl-diskless-sync no 
repl-diskless-sync-delay 5 
repl-disable-tcp-nodelay no 
replica-priority 100 
appendonly no 
appendfilename "appendonly.aof" 
appendfsync everysec 
no-appendfsync-on-rewrite no 
auto-aof-rewrite-percentage 100 
auto-aof-rewrite-min-size 64mb 
aof-load-truncated yes 
lua-time-limit 5000 
slowlog-log-slower-than 10000 
slowlog-max-len 128 
latency-monitor-threshold 0 
notify-keyspace-events "" 
hash-max-ziplist-entries 512 
hash-max-ziplist-value 64 
set-max-intset-entries 512 
zset-max-ziplist-entries 128 
zset-max-ziplist-value 64 
hll-sparse-max-bytes 3000 
activerehashing yes 
client-output-buffer-limit normal 0 0 0 
client-output-buffer-limit replica 256mb 64mb 60 
client-output-buffer-limit pubsub 32mb 8mb 60 
hz 10 
aof-rewrite-incremental-fsync yes

The content of the sentinel-1.conf, sentinel-2.conf, and sentinel-3.conf are the same except for the port. Modify the port to correspond to the port used by the appropriate sentinel:

port 6800     ## The port used by the sentinel
sentinel monitor MY_MASTER 127.0.0.1 6741  ## The name, IP, and port used by the master.
sentinel down-after-milliseconds MY_MASTER 5000
sentinel failover-timeout MY_MASTER 60000 
sentinel parallel-syncs MY_MASTER 1

For the PAC configuration, in ESCWA, the SOR name must match the Redis master name MY_MASTER followed by all the sentinel IP and ports, for example:

set ES_SCALE_OUT_REPOS_1=MY_MASTER=redis,127.0.0.1:6800,127.0.0.1:6801,127.0.0.1:6802##TMP