/stack

A simple Docker Stack deployment of High availability with Redis Sentinel.

Primary LanguageMakefile

About

A simple Docker Stack deployment of High availability with Redis Sentinel.

image

Usage

By default, this stack was designed to deploy 3 instance of sentinel and 5 instance of redis.

Deploy

To deploy the cluster run the following command:

make deploy
# or deploy with redisinsight
make deploy redisinsight=true

Destroy

To destroy the cluster run the following command:

make destroy

Troubleshooting

Benchmarking

To benchmark redis you can run docker exec on to one of the replica or primary redis instance.

source /.rediswarm
redis-benchmark -a ${REDISWARM_SECRET} -q -n 100000

Testing failover

To test the failover you can follow the following steps:

  1. Run docker exec on to one of the replica or primary redis instance.
    docker exec -it rediswarm_replica_1 bash
  2. Run the following command:
    source /.rediswarm
    REDISCLI_AUTH=${REDISWARM_SECRET} redis-cli DEBUG sleep 30

Sentinel failed to connect to other sentinels in the cluster

If you scale up/down your sentinel service chances are that the new sentinel will not be able to connect to the other sentinels in the cluster. In this case, you need to reset the sentinel cluster.

Sentinels never forget already seen Sentinels, even if they are not reachable for a long time, since we don't want to dynamically change the majority needed to authorize a failover and the creation of a new configuration number.

So in order to remove a Sentinel the following steps should be performed in absence of network partitions:

  • Send a SENTINEL RESET * command to all the other Sentinel instances (instead of * you can use the exact master name if you want to reset just a single master). One after the other, waiting at least 30 seconds between instances.
  • Check that all the Sentinels agree about the number of Sentinels currently active, by inspecting the output of SENTINEL MASTER mastername of every Sentinel.