ERR
redis
resource_error
ai_generated
partial
FT.CREATE 失败:为索引 'myidx' 分配内存时内存不足
ERR FT.CREATE failed: Out of memory allocating index 'myidx'
ID: redis/redisearch-index-out-of-memory
78%修复率
82%置信度
1证据数
2024-05-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 7.2.0 | active | — | — | — |
| 7.4.0 | active | — | — | — |
| 8.0.0 | active | — | — | — |
根因分析
Redis Search 模块因 maxmemory 限制或系统内存不足,无法为新索引分配内存。
English
Redis Search module failed to allocate memory for new index due to maxmemory limit or system OOM.
官方文档
https://redis.io/docs/stack/search/解决方案
-
增加 maxmemory:CONFIG SET maxmemory 2gb。然后重试 FT.CREATE。使用 INFO memory 监控。
-
删除未使用的索引以释放内存:FT.DROPINDEX oldidx DD(DD 删除文档)。然后重试。
-
通过在 FT.CREATE 中使用更少的字段或更小的文本字段来减少索引内存开销(例如,关闭 WITHSUFFIXTRIE)。
无效尝试
常见但无效的做法:
-
70% 失败
Setting maxmemory-policy to noeviction prevents eviction but also blocks new writes including index creation; it doesn't free memory.
-
60% 失败
Deleting the index key with DEL may not free memory immediately if the index is still referenced by internal structures; use FT.DROPINDEX instead.