새로운 정보를 깔끔하게 정리해서 이메일로
보내드립니다.
받아보실래요? 좋아요
aof_loading
| 레디스 서버 교육 신청 |
레디스 정기점검/기술지원 Redis Technical Support |
레디스 엔터프라이즈 서버 Redis Enterprise Server |
|---|
AOF Loading은 main()에서 시작한다.
Sentinel 모드이면 AOF나 RDB 로딩을 하지 않는다.
Sentinel 모드가 아니면, loadDataFromDisk()를 실행한다.
loadDataFromDisk()에서 AOF가 ON이면 loadAppendOnlyFile()를 실행해서
AppendOnlyFile을 DB로 로드한다.
AOF가 OFF이면 rdbLoad()를 수행해서 RDB File을 로드한다.
여기서는 loadAppendOnlyFile() 내부 흐름을 설명한다.
redis.log에 위 제목(또는 아래 로그)과 같은 로그가 있으면
"-MISCONF Errors writing to the AOF file: %s"
strerror(server.aof_last_write_errno) -> "Structure needs cleaning"
"after processing the command 'set' from"
로그 발생 소스 위치: server.c processCommand()
✅ 위 에러가 발생하면(LOG:redis.log) AOF 파일이 제대로 쓰여지지 않은 것이다.
이것은 redis-check-aof --fix 를 실행해도 고쳐지지 않을 수도 있다.
즉시, 다음 2가지 중 하나를 선택해서 실행한다.
레디스 서버 시작 후 AOF Loading 중 에러 발생
로그 발생 소스 위치: aof.c loadAppendOnlyFile()
fmterr:
serverLog(LL_WARNING,"Bad file format reading the append only file: make a backup of your AOF file,
then use ./redis-check-aof --fix <filename>");
exit(1);
위 에러가 발생하면 AOF 로딩이 중단되고 서버도 중단된다.
조치 방법: redis-check-aof --fix 실행
$ redis-check-aof --fix appendonly.aof -> 실행
🚫 실행 후 아무키도 치지말고 기다려야 한다.
관련 소스: redis-check-aof.c redis_check_aof_main()
'redis-check-aof'는 printf()로 화면에 바로 보여준다.
off_t pos = process(fp) -> AOF 파일 format 확인
printf("AOF analyzed: size=%lld, ok_up_to=%lld, ok_up_to_line=%lld, diff=%lld\n",...) -> 관련 메시지
printf("This will shrink the AOF from %lld bytes, with %lld bytes, to %lld bytes\n",...) -> 관련 메시지
printf("Continue? [y/N]:") 여기서 'y'를 해야한다. 실수로 이전에 먼저 [Enter]를 쳤으면 'N'이 실행된다.
• 'N' 인 경우: "Aborting..." -> exit(1) -> truncate 하지 않고 종료.
• 'y' 인 경우: ftruncate(fileno(fp), pos) -> truncate 실행
truncate 성공 메시지 -> "Successfully truncated AOF"
truncate 실패 메시지 -> "Failed to truncate AOF"
✅ 여기서 'y'를 했으면 aof 파일을 truncate(수정) 했고 다음 LOAD가 제대로 될 수도 있다.
- 디스크 공유 볼륨/클러스터 공유 볼륨(CSV)
- MCCS: MenTech Solution
- VCS 이중화: Veritas Cluster Server는 Symantec사의 HA(high-availability) 솔루션.
| << AOF Rewrite | AOF Loading | AOF fsync is taking too long >> |
|---|