cancel
Showing results for 
Search instead for 
Did you mean: 

Using named recover points with Bart

SOLVED
Highlighted
Silver Adventurer

Using named recover points with Bart

Can you used named recovery points with the bart tool? If so how is it done and is there documentation.
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
EDB Team Member

Re: Using named recover points with Bart

Hi Matt,

Hope you are doing good.

What we understood is that you want to specify a certain time until which the recovery will happen .
Please confirm if our understanding is correct.

We don't have the option for using the recovery_target_name in the bart RESTORE sub-command.


In BART for restoring the following options are available.

Usage:
./bart RESTORE [OPTION]...

Options:
-h, --help Show this help message and exit
-s, --server Name of the server to restore
-i, --backupid ID or Name of the backup to restore
-r, --remote-host Host on which backup will be restored (in format USER@HOST)
-p, --restore-path Path where data will be restored
-g, --target-timestamp
Target timestamp of restore
-x, --target-xid Target XID of restore
-t, --target-tli Target timeline ID of restore
-c, --copy-wals Copy WALs to the 'restore-path' (instead of stream)

Please follow the below link for more information regarding BART.
https://www.enterprisedb.com/docs/en/2.1/bart/toc.html


Thanks,
Swagata

4 REPLIES 4
EDB Team Member

Re: Using named recover points with Bart

Hi Matt,

Hope you are doing good.

What we understood is that you want to specify a certain time until which the recovery will happen .
Please confirm if our understanding is correct.

We don't have the option for using the recovery_target_name in the bart RESTORE sub-command.


In BART for restoring the following options are available.

Usage:
./bart RESTORE [OPTION]...

Options:
-h, --help Show this help message and exit
-s, --server Name of the server to restore
-i, --backupid ID or Name of the backup to restore
-r, --remote-host Host on which backup will be restored (in format USER@HOST)
-p, --restore-path Path where data will be restored
-g, --target-timestamp
Target timestamp of restore
-x, --target-xid Target XID of restore
-t, --target-tli Target timeline ID of restore
-c, --copy-wals Copy WALs to the 'restore-path' (instead of stream)

Please follow the below link for more information regarding BART.
https://www.enterprisedb.com/docs/en/2.1/bart/toc.html


Thanks,
Swagata

Silver Adventurer

Re: Using named recover points with Bart

is there plans to support nameed recovery points in the future?

Moderator

Re: Using named recover points with Bart

Hi Matt,

 

My guess is that you're looking to use the --backup-name feature of BART.  More information can be found in our BART documentation.  In short, it works like this:

 

bash-4.1$ bart backup -s epas9x --backup-name mynewbackup
INFO:  creating backup for server 'epas9x'
INFO:  backup identifier: '1523986596385'
271308/271308 kB (100%), 1/1 tablespace

INFO:  backup completed successfully
INFO:  backup checksum: 1817e3ea55faaf229c7e30014fdbd658 of base.tar
INFO:  
BACKUP DETAILS:
BACKUP STATUS: active
BACKUP IDENTIFIER: 1523986596385
BACKUP NAME: mynewbackup
BACKUP PARENT: none
BACKUP LOCATION: /tmp/bart_backups/epas9x/1523986596385
BACKUP SIZE: 264.95 MB
BACKUP FORMAT: tar
BACKUP TIMEZONE: UTC
XLOG METHOD: fetch
BACKUP CHECKSUM(s): 1
 ChkSum                             File      
 1817e3ea55faaf229c7e30014fdbd658   base.tar  

TABLESPACE(s): 0
START WAL LOCATION: 00000001000000000000000F
BACKUP METHOD: streamed
BACKUP FROM: master
START TIME: 2018-04-17 17:38:30 UTC
STOP TIME: 2018-04-17 17:38:30 UTC
TOTAL DURATION: 0 sec(s)
-bash-4.1$ bart show-backups
 SERVER NAME   BACKUP ID       BACKUP NAME   BACKUP PARENT   BACKUP TIME               BACKUP SIZE   WAL(s) SIZE   WAL FILES   STATUS  
                                                                                                                                       
 epas9x        1523986596385   mynewbackup   none            2018-04-17 17:38:30 UTC   264.95 MB     0.00 bytes    0           active  
 epas9x        1523986379801   none          none            2018-04-17 17:35:30 UTC   264.94 MB     0.00 bytes    0           active  
-bash-4.1$ mkdir /tmp/data
-bash-4.1$ bart restore -s epas9x -i mynewbackup -p /tmp/data
INFO:  restoring backup 'mynewbackup' of server 'epas9x'
INFO:  base backup restored
INFO:  archiving is disabled
INFO:  permissions set on $PGDATA
INFO:  restore completed successfully
-bash-4.1$ cd /tmp/data
-bash-4.1$ ls
backup_label  dbms_pipe  pg_clog       pg_dynshmem  pg_ident.conf  pg_logical    pg_notify    pg_serial     pg_stat      pg_subtrans  pg_twophase  pg_xlog               postgresql.conf
base          global     pg_commit_ts  pg_hba.conf  pg_log         pg_multixact  pg_replslot  pg_snapshots  pg_stat_tmp  pg_tblspc    PG_VERSION   postgresql.auto.conf
-bash-4.1$ 

 Is this what you're looking for?

Level 2 Adventurer

Re: Using named recover points with Bart

I think Matt is asking about pg_create_restore_point(name).  When you call pg_create_restore_point(name), the database server adds a record to the WAL file to record the given name.   Once you have created a restore point, you can instruct PITR (point-in-time recovery) to terminate recovery after reaching that point (name) in the WAL stream.

 

Yes, that's on the road-map for bart, but not available in the current release.

 

     -- Korry