pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to  Straming replication chatch up from archive
2+ messages / 2 participants
[nested] [flat]

* How to  Straming replication chatch up from archive
@ 2023-12-13 12:25  marco.ptz@tiscali.it
  0 siblings, 1 reply; 2+ messages in thread

From: marco.ptz@tiscali.it @ 2023-12-13 12:25 UTC (permalink / raw)
  To: pgsql-general

  
Hi,
we have a doubt interpreting documentation. We have a 9.6
installation master+stand-by in streaming replication.
Master database
is in archive mode and WAL archive destination (NFS) is mounted in both
master and stand-by servers.

The question is regarding this part of
documentation:
(https://www.postgresql.org/docs/9.6/warm-standby.html)

If you use
streaming replication without file-based continuous archiving, the
server might recycle old WAL segments before the standby has received
them. 
If this occurs, the standby will need to be reinitialized from a
new base backup. You can avoid this by setting wal_keep_segments to a
value large enough to
 ensure that WAL segments are not recycled too
early, or by configuring a replication slot for the standby. IF YOU SET
UP A WAL ARCHIVE THAT'S ACCESSIBLE FROM THE STANDBY,
 THESE SOLUTIONS
ARE NOT REQUIRED, SINCE THE STANDBY CAN ALWAYS USE THE ARCHIVE TO CATCH
UP PROVIDED IT RETAINS ENOUGH SEGMENTS.

if the master overwrite the wal
BEFORE they are sent to the standby via replication, does the standby
AUTOMATICALLY start looking in WAL archive destination?
Or this step
have to be made by hand?

regards and thanks in advance
MP 

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: How to Straming replication chatch up from archive
@ 2023-12-14 07:53  Filip Sedlák <filip@sedlakovi.org>
  parent: marco.ptz@tiscali.it
  0 siblings, 0 replies; 2+ messages in thread

From: Filip Sedlák @ 2023-12-14 07:53 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

 > if the master overwrite the wal BEFORE they are sent to the standby via
 > replication, does the standby *automatically* start looking in WAL
 > archive destination?
 > Or this step have to be made by hand?

I understand it works this way: normally, the replica tries to stream 
from master. If it is not able to (for example, the requested WAL has 
been already rotated), then it tries to call the restore_command.

See 
https://www.postgresql.org/docs/current/continuous-archiving.html#BACKUP-PITR-RECOVERY

So you just need to specify where the older WALs are. For example

     restore_command = 'cp /mnt/nfs/archivedir/%f %p'

assuming the server has a similar archive_command that stores WALs into 
that directory.

--
Filip Sedlák






^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2023-12-14 07:53 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-12-13 12:25 How to  Straming replication chatch up from archive marco.ptz@tiscali.it
2023-12-14 07:53 ` Re: How to Straming replication chatch up from archive Filip Sedlák <filip@sedlakovi.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox