redis에서 며칠에 한 번씩 쓰기가 MISCONF로 막힙니다
조회 2 · 댓글 0
세션/캐시 겸 일부 랭킹 데이터를 Redis에 올려두고 쓰는데, 며칠에 한 번씩 갑자기 쓰기 명령이 전부 실패합니다. 애플리케이션(Spring Data Redis) 쪽에서 SET 계열이 아래 에러로 떨어집니다.
MISCONF Redis is configured to save RDB snapshots, but it is currently
not able to persist on disk. Commands that may modify the data set are
disabled, because this instance is configured to report errors during
writes if RDB snapshotting fails (stop-writes-on-bgsave-error option).redis 로그를 보면 그 시점에 이런 라인이 찍혀 있습니다.
* Background saving started by pid 14122
# Can't save in background: fork: Cannot allocate memory
# Background saving error기동 로그에는 처음부터 이 경고도 있었습니다.
# WARNING overcommit_memory is set to 0! Background save may fail
under low memory condition. To fix this issue add
'vm.overcommit_memory = 1' to /etc/sysctl.conf ...환경은 Ubuntu 22.04, Redis 7.0, EC2 t3.small(메모리 2GB, 스왑 없음)입니다. 이상한 건 에러가 날 때 free로 보면 여유 메모리가 남아 있고, df -h로 봐도 디스크는 넉넉하고, dump.rdb가 있는 디렉터리 권한도 redis 소유로 정상입니다. redis-cli config get save 값은 기본값 그대로입니다. redis를 재시작하면 한동안은 멀쩡하다가 다시 같은 증상이 반복됩니다.
메모리도 디스크도 남아 있는데 왜 fork에서 Cannot allocate memory가 나고 저 MISCONF 상태로 빠지는 건지, 어디부터 봐야 할지 감이 안 잡힙니다. 짚어주실 분 계실까요.
로그인 후 답글을 남길 수 있습니다.