Difficulty: Advanced
What does CLIENT PAUSE do, what is the difference between ALL and WRITE mode, and when would you use it in production?
CLIENT PAUSE <timeout-ms> [WRITE | ALL] tells Redis to stop processing commands from normal clients for the given number of milliseconds. Commands are not rejected; they wait and run once the pause ends. Its main purpose is to freeze the dataset briefly so a replica can fully catch up before a controlled failover or migration.
| Mode | What is held back | Typical use |
|---|---|---|
ALL (default) | Every command from normal clients | Hard freeze for a very short switchover |
WRITE (6.2+) | Write commands, plus commands that may write such as EVAL/EVALSHA, PUBLISH and PFCOUNT | Failover while reads keep working |
In WRITE mode, Redis also stops expiring and evicting keys during the pause, so the dataset truly does not change. Replication continues: the primary keeps streaming already-applied writes to replicas, which is exactly what lets them catch up.
CLIENT UNPAUSE (6.2+) ends a pause early.
CLIENT PAUSE 10000 WRITE.master_repl_offset on the primary with the replica's offset (from INFO replication), or use WAIT 1 5000 to confirm replication.REPLICAOF NO ONE to promote it.Because no writes were accepted during steps 2 to 4, no data is lost in the handover. Redis automates this flow: CLUSTER FAILOVER in Cluster and the FAILOVER command for standalone replication (6.2+) both pause writes internally while the replica catches up.
ALL pause stalls health checks too, and orchestrators may decide the node is dead.CLIENT PAUSE is an admin command; application ACL users should not have it.# On the current primary (redis-a)
CLIENT PAUSE 10000 WRITE
INFO replication # note master_repl_offset
# On the replica (redis-b): check it has the same offset
INFO replication # compare slave_repl_offset / master_repl_offset
REPLICAOF NO ONE # promote
# Back on redis-a, after clients point to redis-b
REPLICAOF redis-b 6379
CLIENT UNPAUSE
# Or let Redis do it (6.2+, run on the primary)
# FAILOVER TO redis-b 6379 TIMEOUT 10000
The pause guarantees no new writes land on redis-a while the replica catches up. The built-in FAILOVER command performs the same choreography automatically.
CLIENT PAUSE, WRITE mode, CLIENT UNPAUSE, Failover, Replication offset