pgpool-II -> postgresql-13구성에서
DB서버의 한쪽이 장애가 발생한 경우에는 pgpool온라인리커버리로 대응하지만
2대의 db서버가 동시에 장애가 발생하였을 시에는 아카이브파일로 특정시점에서의 primary복구를 진행하고싶습니다.
현재 테스트 과정에서
기본 실행단계에서는
vi /var/lib/pgsql/13/data/postgresql.conf
archive_mode = on
archive_command = 'cp "%p" "/var/lib/pgsql/archivedir/%f"'
아카이브모드를 온시켜두었으며
2대의 DB서버를 모두 서비스 정지시킨후
sudo systemctl stop postgresql-13
pg_basebackup -D /tmp/postgres/backup -F t -X n -z
rm -rf /var/lib/pgsql/13/data/*
cd /var/lib/pgsql/13/data/
tar xvzf /nfs/postgres/backup/base.tar.gz
vi /var/lib/pgsql/13/data/postgresql.conf
restore_command = 'cp /var/lib/pgsql/archivedir/%f %p'
restore_command를 수정하고
touch /var/lib/pgsql/13/data/recovery.signal
systemctl start postgresql-13
리커버리모드로 셋팅을 하여 primary기의 복구 -> pgpool온라인리커버리standby구성까지는 성공하였으나
특정시점으로의 리커버리를위해
recovery_target_lsn
recovery_target_action
또는
recovery_target_time
을 설정하여 같은 방법으로 복구를 실시하였을때 서비스 실행단계에서 실패하는것을 확인하였습니다.
postgresl.conf설정자체는 인식하는것같지만 복원대상의 WAL파일과의 연계가 이루어지지 않는것처럼 확인이 되고있습니다.
아카이브 파일로 데이터베이스 지점복구에 대해 구성하신분들의 자문을 듣고싶습니다...
로그정보
2021-06-22 06:45:55.500 UTC [5446] LOG: starting PostgreSQL 13.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1), 64-bit
2021-06-22 06:45:55.501 UTC [5446] LOG: listening on IPv4 address "0.0.0.0", port 5432
2021-06-22 06:45:55.501 UTC [5446] LOG: listening on IPv6 address "::", port 5432
2021-06-22 06:45:55.503 UTC [5446] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-06-22 06:45:55.505 UTC [5446] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2021-06-22 06:45:55.508 UTC [5449] LOG: database system was shut down at 2021-06-22 06:42:24 UTC
cp: cannot stat '/var/lib/pgsql/archivedir/0000000B.history': No such file or directory
2021-06-22 06:45:55.514 UTC [5449] LOG: starting point-in-time recovery to 2021-06-22 06:41:00+00
2021-06-22 06:45:55.517 UTC [5449] LOG: restored log file "0000000A.history" from archive
cp: cannot stat '/var/lib/pgsql/archivedir/0000000A000000000000006F': No such file or directory
2021-06-22 06:45:55.524 UTC [5449] LOG: consistent recovery state reached at 0/6F0000A0
2021-06-22 06:45:55.524 UTC [5449] LOG: invalid record length at 0/6F0000A0: wanted 24, got 0
2021-06-22 06:45:55.524 UTC [5449] LOG: redo is not required
2021-06-22 06:45:55.524 UTC [5449] FATAL: recovery ended before configured recovery target was reached
2021-06-22 06:45:55.526 UTC [5446] LOG: database system is ready to accept read only connections
2021-06-22 06:45:55.527 UTC [5446] LOG: startup process (PID 5449) exited with exit code 1
2021-06-22 06:45:55.527 UTC [5446] LOG: terminating any other active server processes
2021-06-22 06:45:55.534 UTC [5446] LOG: database system is shut down
|