ERR Background save already in progress: Background save already in progress
Redis의미
새 백그라운드 저장(BGSAVE)이나 AOF rewrite를 시작하려 했지만 이미 백그라운드 저장이 진행 중이다. 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 (subscribe 컨텍스트에서 허용되지 않는 명령)
- ERR SELECT is not allowed in cluster modeSELECT is not allowed in cluster mode
- 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 (numkeys가 인수 개수를 초과)
- ERR WATCH inside MULTI is not allowedWATCH inside MULTI is not allowed