Re: Hot and PITR backups in same server - Mailing list pgsql-general

From Andrus
Subject Re: Hot and PITR backups in same server
Date
Msg-id 0B5B726FEF194328AAFABFC6AF66838D@dell2
Whole thread Raw
In response to Re: Hot and PITR backups in same server  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
List pgsql-general
Hi!

Thank you.

>As Laurentz said, even if you set it to 5TB, no WAL files older than
>the files needed by the last checkpoint don't remain. If you don't
>need a hot-standby, you can use pg_receivewal to save WAL files on the
>"standby" server.  If you need the hot-standby, WAL files should be
>archived.

So pg_receivewal  should running in parallel with hot standy server to receive wal files to separate directory.

Will each wal file transferred two times in this case? One time by hot standby server and second time by
pg_receivewal.
Main server if priced by amount of bandwidth.
How to receive each wal file only once ? This would allow to decrease network bandwidth and thus cost two times.

pg_receivewal has compression option. Will this compress WAL files before transfer over network ?

>If so, what you need seems to be pg_receivewal, not a full-fledged
>server.

For hot standby and PITR in same server the following steps are required:

1. Create base backup using pg_basebackup
2. Create copy of base backup for PITR
3. Start hot standby server using data directory created in p.1
4. Run pg_receiceval as background process to save wal files to backup created in p.2

If PITR is required, specify recovery time in base backup created in p.2 in postgresql.conf
Start second postgresql server instance in port 5433 which uses this backup for recovery.

Is this OK or should something changed?

How to run pg_receivewal in background ? Is there some option which creates such service so will automatically restart
ifserver is 
 
restarted ?

How to allow main server to keep sufficient number of WAL segments ?
Replication slot cannot used: if backup server stops replication_slot causes main server to fill disk space with
untransferredWAL 
 
files.
After  that main server will also stop with "no space left on device" error.

Or is there some option like to reserve some disk space or limit wal size so that main server can continue on backup
servercrash.
 

Andrus. 




pgsql-general by date:

Previous
From: Tory M Blue
Date:
Subject: Re: Huge tables, trying to delete OID's taking 6+hours per table
Next
From: Ishan Joshi
Date:
Subject: idle_in_transaction_session_timeout not getting log in PG v12.2