Redis Sentinel repeatedly promotes and then re-demotes master after IO stall during AOF rewrite
Environment
Redis 6.2 cluster using AOF persistence, three Sentinels across VMs, master and two replicas on VMs with local HDD-backed storage high I/O load during nightly logrotate; during AOF BGREWRITE the master blocks for several seconds and replicas report lag and OOM-like disconnects; Sentinel elects failover then reverses within minutes.
Symptoms
Spikes of Redis role changes: master promoted then demoted back to original within minutes, client errors during windows, replicas show reproduction backlog growth, and AOF rewrite log shows 'Background append only file rewrite started' followed by long pause. System IO wait on host increases drastically during the rewrite.
Observations
Sentinel logs show ODOWN then FAILOVER_START and then a manual-ish reconfiguration to previous master; during the pause replication offsets diverge; disk iostat shows >200ms write latency, and dmesg shows kernel writeback pressure. Replicas periodically disconnect and reconnect leading to replication backlog growth. No kernel panics.
Already attempted
Raised replica-priority and adjusted min-slaves-to-write (no change), temporarily disabled AOF rewrite on master (reduced churn but unacceptable for persistence), tuned vm.dirty_ratio (experimented without durable improvement), tried upgrading Redis but environment still hits heavy disk latency windows.
Question
Why is Sentinel oscillating promotions after AOF rewrite stalls, and what stable configuration stops flip-flop failovers while preserving AOF durability?
Verified community troubleshooting
No answers yet..
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags