Postgresql – Postgres: What happens if your slave DB went down temporarily

postgresqlreplication

I have a master DB that is replicated to a slave DB through binary replication. What happens if this slave DB were to go offline for a period of time? Would it eventually catch up with the master as soon as it goes back online (without much intervention)?

Best Answer

The answer is yes. What is actually happening is that the slave receives binary patch files and applies those. It is slightly complicated but in general your slave can be offline temporarily and then later catch up. I would imagine that there are limits in the amount of time that can pass but in the event that it falls too far behind you can use WAL segments to catch up (as I understand it, unarchived wal segments are the primary key here, so if you pass the point where you need archived segments to catch up, you will need those segments accessible via log shipping or the like).