OOM data resource_error ai_generated true

Redis内存不足:已用内存超过'maxmemory'时不允许执行命令

Redis OOM command not allowed when used memory > 'maxmemory'

ID: data/redis-oom-command-not-allowed

其他格式: JSON · Markdown 中文 · English
87%修复率
89%置信度
1证据数
2023-08-12首次发现

版本兼容性

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

根因分析

Redis达到配置的maxmemory限制,且逐出策略设置为noeviction,导致写入命令因内存不足而失败。

English

Redis reaches its configured maxmemory limit and the eviction policy is set to noeviction, causing write commands to fail with OOM error.

generic

官方文档

https://redis.io/docs/latest/operate/oss_and_stack/management/admin/#maxmemory

解决方案

  1. Change the eviction policy to allkeys-lru to automatically evict least recently used keys when memory is full.
  2. Add more RAM to the server and increase maxmemory to a safe limit below total RAM.

无效尝试

常见但无效的做法:

  1. 85% 失败

    Without setting an eviction policy, Redis will fill up again quickly.

  2. 75% 失败

    If the system has no free RAM, Redis will swap to disk, severely degrading performance.