FULL AI ANALYSIS

Redis Sentinel repeatedly promotes and then re-demotes master after IO stall during AOF rewrite

Generated Oct 30, 2026, 9:42:13 AM

Analysis summary

Sentinel uses replica reachability and replication offset to decide failover. Long AOF rewrites that block Redis main thread (or cause the master to stop acknowledging) make Sentinels mark master as ODOWN and start failover. If the master recovers quickly and replicas later rejoin with different offsets, Sentinels may reconfigure roles back, causing oscillation. Core issues: slow disk causing long AOF bgrewrite blocking/backpressure, tight Sentinel timeouts, and insufficient quorum or partial network packet loss during high IO. Resolving requires reducing AOF rewrite impact (use faster storage, disable synchronous fsync during rewrite, schedule rewrites off-peak), lengthening Sentinel down-after-milliseconds, and ensuring replicas can catch up without being removed from quorum.

Possible causes

Master AOF BGREWRITE causes long main-thread stalls due to slow HDD I/O, making Sentinels mark master ODOWN

90%

Sentinel timeouts (down-after-milliseconds, failover-timeout) are too aggressive for the observed I/O stall window

70%

Replication backlog insufficient; replicas can't catch up after stall so Sentinels detect inconsistent topology and revert roles

55%

Underlying host experiencing IO contention from unrelated processes (logrotate, backups) causing kernel writeback pressure and Redis blocking

45%

Suggested fixes

1

Diagnostic step 1

Move Redis AOF rewrite to faster storage (SSD) or reduce AOF rewrite frequency by tuning auto-aof-rewrite-percentage/size; test impact in staging.

2

Diagnostic step 2

Temporarily increase sentinel down-after-milliseconds and failover-timeout to larger values (e.g., 60s) so brief AOF-induced stalls do not trigger failover; apply on all Sentinels atomically.

3

Diagnostic step 3

Ensure replication backlog (repl-backlog-size) is large enough for the stall window, and check replicas' disk I/O health so they can catch up after pause.

4

Diagnostic step 4

Schedule BGREWRITEOFF/stop writes window during known heavy host IO (avoid running other heavy jobs simultaneously) and monitor iowait with iostat during a test rewrite.

5

Diagnostic step 5

If the problem continues after storage and timeout tuning, consider moving to diskless replication or using Redis replication over faster network/storage and engage ops/storage team for host-level IO troubleshooting.