안녕하세요,
운영 중인 고객사 DB의 대개체(업그레이드) 후 발생한 문제에 대해 선배님들의 고견을 여쭙숩니다..
DB 자체 개선으로 인한, 백업 방식의 개선이 필요한 상황인데 어떤 좋은 방법이 있을까요? ㅠㅠ (netbackup 솔루션은 사용하고 싶습니다.)
1. 기존 환경
- DB : PostgreSQL 12
- 백업 솔루션 : netbackup
- 백업 방식 : 선행 함수 수행(pg_start_backup) -> 백업 솔루션 동작(F/S 카피) -> 후행 함수 수행(pg_stop_backup)
2. 신규 환경
- DB : PostgreSQL 15.6
- 백업 솔루션 : netbackup
- 백업 방식 : 문제 발생!
3. 문제 발생의 원인
- PostgreSQL 15버전에서, 개선의 일환으로 Exclusive Backup Mode가 제거 되었습니다.
* 릴리즈노트
Remove long-deprecated exclusive backup mode (David Steele, Nathan Bossart) §
If the database server stops abruptly while in this mode, the server could fail to start. The non-exclusive backup mode is considered superior for all purposes. Functions pg_start_backup()/pg_stop_backup() have been renamed to pg_backup_start()/pg_backup_stop(), and the functions pg_backup_start_time() and pg_is_in_backup() have been removed.
* 참고 정보
https://www.enterprisedb.com/blog/exclusive-backup-mode-finally-removed-postgres-15
4. 문제 현상
- 위 근거로, 개선된 백업 함수인 pg_backup_start/pg_backup_stop은 동일 트랜잭션에서만 수행이 가능하여 기존 백업 방식은 사용이 불가합니다.
- w/a로 파이썬 스크립트 작성을 통한 트랜잭션 유지(listen 활용)를 꾀하였으나 아래 에러와 함께 충돌이 발생합니다..
ERROR: could not access status of transaction 2001858181
DETAIL: Coud not open file "pg_xact/0775": No such file or directory.
STATEMENT: select pg_backup_start('backup'); listen start_backup;
WARNING: aborting backup due to backend exiting before pg_backup_stop was called
|