redis config_error ai_generated true

警告:驱逐策略 'allkeys-lru' 与副本上的 'maxmemory-policy' 设置不兼容

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

ID: redis/eviction-policy-mismatch

其他格式: JSON · Markdown 中文 · English
90%修复率
86%置信度
1证据数
2023-09-05首次发现

版本兼容性

版本状态引入弃用备注
Redis 6.0 active
Redis 7.0 active
Redis 7.2 active

根因分析

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

English

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

generic

官方文档

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

解决方案

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

无效尝试

常见但无效的做法:

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

    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% 失败

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