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