What happens to your app when the Redis box dies?
Why a cache needs high availability, how Sentinel and Cluster fail over, and the writes a failover can lose.
"It is only a cache" is true until the cache goes down at peak. Every request falls through to the main database at once, and the database that was sized for cache misses gets all of them.
The main database behind the cache, and anything you keep only in Redis: sessions, carts, rate limits, queues.
Sentinel watches one master and its replicas and fails over. Redis Cluster splits keys across several masters, each with replicas.
Replication is asynchronous. A write the master acknowledged but had not copied is lost in a failover. Redis does not promise otherwise.
Plan for a cold restart anyway: how long does the app take to warm the cache, and can the database survive it?
Run at least three Sentinels, on boxes that fail independently. The quorum (set per master) decides when the master is considered down; a majority of Sentinels must still be able to talk before any failover starts. Clients ask Sentinel for the current master instead of hard-coding it.
Step through it:
# sentinel.conf on three separate hosts sentinel monitor cache 10.0.0.11 6379 2 sentinel down-after-milliseconds cache 5000 sentinel failover-timeout cache 60000 # from a client or redis-cli: SENTINEL get-master-addr-by-name cache
When one master is not enough memory or throughput, Redis Cluster spreads the 16384 hash slots across masters. The usual minimum is three masters with one replica each, in different zones. A master that cannot reach a majority of masters for cluster-node-timeout stops accepting writes, which limits how long a cut-off master can take writes that will be lost.
Step through it:
Sources: Redis Sentinel, Scale with Redis Cluster.
How do databases actually work? From one row on disk to transactions: the words you need, PostgreSQL, MySQL and MongoDB from the files up, then Redis, Cassandra and vector search, side by side, and the query and concurrency traps.