Fabry
Fabry

Reputation: 1650

Postgres replica out of sync

we have a postgres 9.6 replica configured among 2 servers. We used the following configuration to create the replica:

postgresql.conf

wal_level = hot_standby                        
max_wal_senders = 5
wal_keep_segments = 32
archive_mode = on   
archive_command = 'cp %p /archive/%f'

The problem is that the servers has been restarted due to some maintenance tasks and now they are out of sync.

Since the DB is very large, how can we restore the replica and then synchronize the data without having the application down more then 5/10 minutes? Can it be done in background while the application on the master site is being used?

Upvotes: 1

Views: 1217

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246013

Add a restore_command to recovery.conf that can restore archived WALs, then the standby can use them to catch up.

You need to restart the standby server to activate changes in recovery.conf.

Upvotes: 1

Related Questions