I have a question about PITR(Point In Time Recovery) with barman.

766 views
Skip to first unread message

fkdl...@gmail.com

unread,
Apr 12, 2016, 8:26:14 PM4/12/16
to Barman, Backup and Recovery Manager for PostgreSQL

Hi all,

I have a question about PITR(Point In Time Recovery) with barman.

 

Here is command I ran.

barman recover --target-time "2016-04-03 15:39:40 UTC" --remote-ssh-command "ssh postgres@127.0.0.1" main 20160403T080506 /var/lib/postgresql/9.4/main

 

I wanted to get the data of this point 2016-04-03 15:39:40.

But I was able to get  the previous data than 2016-04-03 15:39:40.

(I expected to get the data around 2016-04-03 15:39:40. There were also data around that time)


In log, I got some message with red line.

cp: cannot stat ‘barman_xlog/0000000100000043000000D8’: No such file or directory.

And last completed transaction was at log time 2016-04-03 15:39:30….

I think above wal file had a data around 2016-04-03 15:39:40.

But that wal file didn’t copy to barman_xlog.


After that, I changed recovery time in the command as below.(added 10 sec, 15:39:40 -> 15:39:50)

barman recover --target-time "2016-04-03 15:39:50 UTC" --remote-ssh-command "ssh postgres@127.0.0.1" main 20160403T080506 /var/lib/postgresql/9.4/main

 

I was able to get the data I want. And wal files needed for recovery was copied.




Could you explain why?

Why wal file needed for PITR wasn’t copied ?


Have a good day.

Gabriele Bartolini

unread,
Apr 13, 2016, 3:32:33 AM4/13/16
to pgba...@googlegroups.com
Ciao fkdla171,

  my question is: are you sure that the WAL file had been copied to Barman from the PostgreSQL server before issuing the first recovery?

  I also suggest that you look at 'get-wal' recovery option so that it is the server itself that you try and recover which pulls WAL files on demand from Barman (you might have to setup SSH connections).

Cheers,
Gabriele

--
 Gabriele Bartolini - 2ndQuadrant Italia - Director
 PostgreSQL Training, Services and Support
 gabriele....@2ndQuadrant.it | www.2ndQuadrant.it

--
--
You received this message because you are subscribed to the "Barman for PostgreSQL" group.
To post to this group, send email to pgba...@googlegroups.com
To unsubscribe from this group, send email to
pgbarman+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/pgbarman?hl=en?hl=en-GB

---
You received this message because you are subscribed to the Google Groups "Barman, Backup and Recovery Manager for PostgreSQL" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pgbarman+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

fkdl...@gmail.com

unread,
Apr 13, 2016, 7:15:51 PM4/13/16
to Barman, Backup and Recovery Manager for PostgreSQL
Hi Gabriele,

Thank you for your quick reply. :)
A: master server, B: test server, C: backup sever is installed barman with wal archive.

I’m trying to recover db backup with PITR from backup server(C) to test server.(B)

But as you said, barman doesn’t copy wal file needed for PITR sometimes.

I’m preparing to test with get-wal option.



fkdl...@gmail.com

unread,
May 10, 2016, 8:19:45 PM5/10/16
to Barman, Backup and Recovery Manager for PostgreSQL

Hi Gabriele,

It's been a long time since I commented.
I've been tested with get-wal option.
Almost test has been successed PITR(point-in-time recovery).

1) restore_command = 'cp barman_xlog/%f %p'
2) restore_command = 'ssh bar...@100.5.1.1 barman get-wal main %f > %p'

What is different between 1) and 2)?
Why 2) is more stable than 1) ?

Have a good day~
Reply all
Reply to author
Forward
0 new messages