Sample Header Ad - 728x90

PostgreSQL Failure To Reinitialise Replica With pg_basebackup

0 votes
0 answers
44 views
I have a master-replica PostgreSQL 9.5 setup. I'm trying to reinitialize the replica by doing the following: - Stop replica service ( /etc/init.d/postgresql stop ) - Clear data directory ( rm -rf /path/to/postgresql/data ) - Start pg_basebackup ( sudo pg_basebackup -h master-host -D /path/to/postgresql/data/ --checkpoint=fast -X stream -R -P -v -U replication ) - Start replica service ( /etc/init.d/postgresql start ) Some details: - It takes the pg_basebackup process to complete around 45mins. - I'm using -X stream to keep up with the changes happening on master while the backup is taking place. - When the process has finished, the data directory in the replica is ~2GB smaller than the master's (743GB vs 745GB). When starting the service, these are the output logs: LOG: database system is shut down LOG: database system was interrupted; last known up at 2024-03-18 20:48:03 UTC LOG: entering standby mode LOG: redo starts at 1820/41000098 [unknown]@[unknown] LOG: incomplete startup packet LOG: consistent recovery state reached at 1820/4A8CB950 LOG: started streaming WAL from primary at 1820/4B000000 on timeline 1 postgres@template1 FATAL: the database system is starting up postgres@template1 FATAL: the database system is starting up The service is started but any interaction with it results in the fatal error: database system is starting up Am I missing something in the reinitialisation of the replica? What is causing this behaviour?
Asked by Aaron Ullal (111 rep)
Mar 19, 2024, 07:43 AM