ERR Background save already in progress: Background save already in progress(后台保存已在进行中)
Redis含义
您试图启动新的后台保存(BGSAVE)或 AOF 重写,但已有后台保存正在进行。Redis 不允许同时运行第二个保存进程。
原因
在上一次完成之前触发了新的 BGSAVE/BGREWRITEAOF;在大数据集上 fork/保存耗时较长时,监控脚本或应用反复调用 BGSAVE。磁盘较慢或 RDB 文件较大会延长该过程。
解决方法
等待正在运行的保存完成;用 INFO persistence 中的 rdb_bgsave_in_progress 和 aof_rewrite_in_progress 字段以及 LASTSAVE 时间戳检查其状态。为应用/自动化逻辑加上条件,使其在上一次保存完成之前不触发新的 BGSAVE。如果保存耗时过长,调查磁盘速度和 RDB 大小。
同一数据库的其他条目
- ERR Can't execute '<cmd>': only (P|S)SUBSCRIBE / (P|S)UNSUBSCRIBE / PING / QUIT / RESET are allowed in this contextCommand not allowed in subscribe context(在订阅上下文中不允许该命令)
- ERR SELECT is not allowed in cluster modeSELECT is not allowed in cluster mode(集群模式下不允许 SELECT)
- ERR wrong number of arguments for commandWrong number of arguments for command(命令的参数数量错误)
- ERR bit offset is not an integer or out of rangeBit offset is not an integer or out of range(位偏移量不是整数或超出范围)
- ERR Protocol error: invalid multibulk lengthProtocol error: invalid multibulk length(协议错误:无效的 multibulk 长度)
- ERR Number of keys can't be greater than number of argsEVAL/EVALSHA: numkeys exceeds argument count(EVAL/EVALSHA:numkeys 超过参数数量)
- ERR WATCH inside MULTI is not allowedWATCH inside MULTI is not allowed(不允许在 MULTI 中使用 WATCH)