RE: Running rsync backups in pg15

From: <msalais(at)msym(dot)fr>
To: "'Murthy Nunna'" <mnunna(at)fnal(dot)gov>, <pgsql-admin(at)postgresql(dot)org>
Subject: RE: Running rsync backups in pg15
Date: 2024-11-11 19:38:49
Message-ID: 026f01db3471$551dd990$ff598cb0$@msym.fr
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,

First of all, have you ever thought what happens if your database crashed
while you are updating your single backup?! It is really a dangerous
scenario there!

But any way, I suppose you are using psql to do your pg_start_backup(),
pg_stop_backup().

What about this one (I didn’t change function names):

Select pg_start_backup();

\! your_rsync_script…

Select pg_stop_bacup();

This could be more sophisticated if you want…

Regards

Michel SALAIS

De : Murthy Nunna <mnunna(at)fnal(dot)gov>
Envoyé : jeudi 7 novembre 2024 17:35
À : pgsql-admin(at)postgresql(dot)org
Objet : Running rsync backups in pg15

Hi,

In PG14 and earlier, there is no requirement to keep database connection
while rsync is in progress. However, there is a change in PG15+ that
requires rsync to be while we have the same database session open that
executes SELECT pg_backup_start('label'). This change requires a rewrite of
existing scripts we have.

Currently (pg14):

In bash script (run from cron)

1. psql Select pg_start_backup
2. rsync
3. psql Select pg_stop_backup

In pg15 and later:

In bash script (run from cron)

psql

Select pg_start_backup

! run-rsync-script

Select pg_stop_backup

It can be done, but it makes it ugly to check errors and so forth that occur
in the rsync script.

Anybody found an elegant way of doing this?

Thank you in advance for your ideas.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Koen De Groote 2024-11-11 19:40:40 Re: Inquiry on Setting Up Automatic Failover with Stream Replication
Previous Message Murthy Nunna 2024-11-11 17:52:50 RE: Running rsync backups in pg15