barman recover - is my understanding fairly acurate?

11 views
Skip to first unread message

dulh...@mailbox.org

unread,
Dec 28, 2021, 8:47:55 AM12/28/21
to pgba...@googlegroups.com
I am trying to get streaming backups with barman up'n'running.
Why streaming? Can't really tell, It seemed to me like to best option for least RPO/RFO ratio.

now ... I seem to be able to produce backups by running barman backup [server_name] and I believe the action in case of recovery (onto a separate recovery server, witch looks almost identical to the original pg_server via the pg-recover command.
  1. is the above a fair assumption?
  2. would it be a common scenario to put the barman backup [server_name] command in a cron job for the barman user, running once or twice a day?
  3. I guess barman recover server_name backup_id destination_directory would be a basic recovery command to run. Is that so?
    1. my postgress data lives at /opt/db/data/postgres/data, so I assume that to be the content for the destination_directory placeholder in the above command. Is that a good guess?
  4. let's say I have to backups (like 20211225T031122 & 20211225T120033) available and want to execute a PITR for 20211225 @10:00 am ... would --target-time 202112-12-25:10:00:00 be the correct option (with barman in the background doing it"s magic to figure out how to get to that exact PIT state) to achieve this?
  5. how do you address the recovery postgres server the recovery should be executed at? (the help mentions a --target-name option. If that is the one can somebody explain how and where (barman server, postgresql server) exactly to define that name?
thx and best
Gunnar

Luca Ferrari

unread,
Dec 29, 2021, 4:56:28 AM12/29/21
to Barman, Backup and Recovery Manager for PostgreSQL
On Tue, Dec 28, 2021 at 2:47 PM dulhaver via Barman, Backup and
Recovery Manager for PostgreSQL <pgba...@googlegroups.com> wrote:
> would it be a common scenario to put the barman backup [server_name] command in a cron job for the barman user, running once or twice a day?

Yes, but AFAIK barman does a full backup each time it is invoked, so
you should not abuse of it because you are going to have network and
I/O traffic. It depends on how fast you want to be in recover.

> I guess barman recover server_name backup_id destination_directory would be a basic recovery command to run. Is that so?

Yes, but read the documentation.

>
> my postgress data lives at /opt/db/data/postgres/data, so I assume that to be the content for the destination_directory placeholder in the above command. Is that a good guess?
>

The directory is where you want to place the PGDATA on the destination
server, therefore if you are restoring on an identical server yes,
otherwise restore wherever you want.

> let's say I have to backups (like 20211225T031122 & 20211225T120033) available and want to execute a PITR for 20211225 @10:00 am ... would --target-time 202112-12-25:10:00:00 be the correct option (with barman in the background doing it"s magic to figure out how to get to that exact PIT state) to achieve this?

I don't think barman is able to do such magic, that is you have to
select the set from which you want to recover from. It does not matter
which backup set you select, because as far as archiving is working,
you can restore to any point from the backup to a later time. However,
the most your backup is near the point, the faster it is. For example,
having a one day backup, if you want to recover to yesterday don't
start from the monday backup, because it needs to start applying all
transactions from monday to tuesday. Start from tuesday backup if
possible.

> how do you address the recovery postgres server the recovery should be executed at? (the help mentions a --target-name option. If that is the one can somebody explain how and where (barman server, postgresql server) exactly to define that name?

Thats a restore point name, see pg_create_restore_point
<https://www.postgresql.org/docs/current/runtime-config-wal.html>.

Luca

dulh...@mailbox.org

unread,
Dec 29, 2021, 7:25:54 AM12/29/21
to pgba...@googlegroups.com
On 12/29/2021 10:55 AM Luca Ferrari <fluc...@gmail.com> wrote:


On Tue, Dec 28, 2021 at 2:47 PM dulhaver via Barman, Backup and
how do you address the recovery postgres server the recovery should be executed at? (the help mentions a --target-name option. If that is the one can somebody explain how and where (barman server, postgresql server) exactly to define that name?

Thats a restore point name, see pg_create_restore_point

so, if --target-name is not the parameter to address the recovery machine in the barman recover command ... how do you provide that information to barman?

Luca Ferrari

unread,
Dec 30, 2021, 6:00:27 AM12/30/21
to Barman, Backup and Recovery Manager for PostgreSQL
--

I think you need to look at the --remote-ssh set of parameters.

Luca
Reply all
Reply to author
Forward
0 new messages