database
resource_error
ai_generated
true
redis.exceptions.ResponseError: -OOM command not allowed when used memory > 'maxmemory'.
ID: database/redis-maxmemory-policy-eviction-blocked
85%Fix Rate
90%Confidence
1Evidence
2023-11-05First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Redis 6.2 | active | — | — | — |
| Redis 7.0 | active | — | — | — |
| Redis 7.2 | active | — | — | — |
Root Cause
Redis has reached its maxmemory limit and the configured eviction policy (maxmemory-policy) cannot free enough space, or the policy is set to 'noeviction', causing write commands to be rejected.
generic中文
Redis 已达到 maxmemory 限制,并且配置的逐出策略 (maxmemory-policy) 无法释放足够的空间,或者策略设置为 'noeviction',导致写命令被拒绝。
Official Documentation
https://redis.io/docs/latest/operate/oss_and_stack/management/admin/#maxmemoryWorkarounds
-
90% success Set an appropriate eviction policy: CONFIG SET maxmemory-policy allkeys-lru (or volatile-lru, allkeys-lfu, etc.) via redis-cli. Then verify with CONFIG GET maxmemory-policy.
Set an appropriate eviction policy: CONFIG SET maxmemory-policy allkeys-lru (or volatile-lru, allkeys-lfu, etc.) via redis-cli. Then verify with CONFIG GET maxmemory-policy.
-
80% success Increase maxmemory if feasible: CONFIG SET maxmemory 2gb (or edit redis.conf and restart). Also monitor memory usage with INFO memory to ensure the new limit is sufficient.
Increase maxmemory if feasible: CONFIG SET maxmemory 2gb (or edit redis.conf and restart). Also monitor memory usage with INFO memory to ensure the new limit is sufficient.
中文步骤
Set an appropriate eviction policy: CONFIG SET maxmemory-policy allkeys-lru (or volatile-lru, allkeys-lfu, etc.) via redis-cli. Then verify with CONFIG GET maxmemory-policy.
Increase maxmemory if feasible: CONFIG SET maxmemory 2gb (or edit redis.conf and restart). Also monitor memory usage with INFO memory to ensure the new limit is sufficient.
Dead Ends
Common approaches that don't work:
-
Increase maxmemory without addressing the eviction policy or data growth pattern
80% fail
Memory will eventually fill up again if the root cause (e.g., unbounded cache growth, no eviction) is not fixed.
-
Flush all keys using FLUSHALL or FLUSHDB without restarting or changing config
70% fail
While this temporarily frees memory, the same pattern of writes will cause the error to recur unless the eviction policy is adjusted.