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

- **ID:** `redis/eviction-policy-mismatch`
- **Domain:** redis
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

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

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Redis 6.0 | active | — | — |
| Redis 7.0 | active | — | — |
| Redis 7.2 | active | — | — |

## Workarounds

1. **Align the replica's maxmemory-policy with the master: CONFIG SET maxmemory-policy allkeys-lru on the replica (or match the master's policy).** (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).
   ```
2. **Check both configurations: redis-cli CONFIG GET maxmemory-policy on master and replica, then update the replica's config file permanently.** (85% success)
   ```
   Check both configurations: redis-cli CONFIG GET maxmemory-policy on master and replica, then update the replica's config file permanently.
   ```

## Dead Ends

- **Ignore the warning, assuming it's harmless** — Can lead to data inconsistency between master and replica, or unexpected evictions on replica. (50% fail)
- **Set a different policy on the replica without matching the master** — Replicas must follow the master's eviction policy to maintain consistency; otherwise, replication may fail. (60% fail)
