본문으로 건너뛰기

5.4 Restore와 PITR

Restore는 target data directory가 비어 있고 PostgreSQL이 중지된 격리 환경에서 수행합니다. 명령 전에 선택될 backup을 info로 확인합니다.

pgbackrest --stanza=app info
pgbackrest --stanza=app restore

Time target PITR 예시는 다음과 같습니다.

pgbackrest --stanza=app \
--type=time \
--target='2026-09-01 10:14:30+09' \
--target-action=pause \
restore

--delta는 target의 기존 file을 활용할 수 있지만 잘못된 target path에서 사용하면 위험합니다. 처음 훈련은 빈 target으로 진행하고 delta restore의 전제와 검증 범위를 별도로 학습합니다.

Restore 후 PostgreSQL log에서 archive-get과 recovery target 도달을 확인합니다. Pause 상태에서 read-only 검증을 수행한 뒤 replay 재개 또는 promotion을 결정합니다.

검증 항목

  • 선택한 backup label과 timeline
  • 마지막 replay timestamp와 LSN
  • Database, extension, role 존재
  • 핵심 table row count와 business invariant
  • Application smoke query
  • 실제 RPO와 단계별 RTO

복구가 한 번 성공했다고 repository 전체가 건강하다고 판단하지 않습니다. 다른 age와 backup type도 rotation해 시험합니다.