redis config_error ai_generated true

WARNING: Eviction policy 'allkeys-lru' not compatible with 'maxmemory-policy' setting on replica

ID: redis/eviction-policy-mismatch

Also available as: JSON · Markdown · 中文
90%Fix Rate
86%Confidence
1Evidence
2023-09-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Redis 6.0 active
Redis 7.0 active
Redis 7.2 active

Root Cause

The eviction policy configured on a replica node differs from the master's policy, causing inconsistent memory management during replication.

generic

中文

副本节点上配置的驱逐策略与主节点的策略不同,导致复制期间内存管理不一致。

Official Documentation

https://redis.io/docs/latest/operate/oss_and_stack/management/eviction/

Workarounds

  1. 90% success Align the replica's maxmemory-policy with the master: CONFIG SET maxmemory-policy allkeys-lru on the replica (or match the master's policy).
    Align the replica's maxmemory-policy with the master: CONFIG SET maxmemory-policy allkeys-lru on the replica (or match the master's policy).
  2. 85% success Check both configurations: redis-cli CONFIG GET maxmemory-policy on master and replica, then update the replica's config file permanently.
    Check both configurations: redis-cli CONFIG GET maxmemory-policy on master and replica, then update the replica's config file permanently.

中文步骤

  1. 将副本的 maxmemory-policy 与主节点对齐:在副本上运行 CONFIG SET maxmemory-policy allkeys-lru(或匹配主节点的策略)。
  2. 检查两个配置:在主节点和副本上运行 redis-cli CONFIG GET maxmemory-policy,然后永久更新副本的配置文件。

Dead Ends

Common approaches that don't work:

  1. Ignore the warning, assuming it's harmless 50% fail

    Can lead to data inconsistency between master and replica, or unexpected evictions on replica.

  2. Set a different policy on the replica without matching the master 60% fail

    Replicas must follow the master's eviction policy to maintain consistency; otherwise, replication may fail.