Postgresql – Postgres master and slave out of sync

postgresql

I am not used to working on the postgres backend. So forgive me if I leave something obvious out.

I have postgres 9.4 running on 3 (debian) servers. #1 is the main prod server. #2 is slave to #1. #3 is for dev.

Currently #2 is out of sync with #1. The #2 server rebooted and was stuck waiting for a password to restart. Several days later it was brought to my attention that #2 was down. I went through the hosting site and was able to get the server back online. Postgres sync between #1 and #2 is broken. I do know that we have the WAL files backed up in an S3 bucket. What I can find online about this issue talks about rebuilding the server.

Is there a way to restart the sync without rebuilding the server?

Best Answer

Only if you have a WAL archive. In that case, you can configure restore_command to catch up from the archive.

Otherwise, rebuilding the standby us your only option.