Barman -> create a new standby(recovery mode) from a previous backup using get-wal

1,029 views
Skip to first unread message

Iñigo Quintana

unread,
Jan 26, 2016, 4:46:09 AM1/26/16
to Barman, Backup and Recovery Manager for PostgreSQL
Hello,

Is is possible to create a clone from Barman backup and leave it in recovery mode  using the get-wall feature?

I am using Barman 1.5 and repmgr 3.0.3.  Postgres 9.4.

I have master and standby configured with get-wall the same way mentioned here http://blog.2ndquadrant.com/getting-wal-files-from-barman-with-get-wal/.

The problem is that with big databases 70GB or 160 GB the clone process from Master to new standby takes too much time it is too expensive in resources (with rsync as well) 

I know there exist pg_rewind (nice to have after failover  for pg 9.5 ) but even the first time you create a clone standby, should be possible to create it from Barman (just because we have already there all the base backups + wals).

Is is posible right know? How?

Many thanks and best regards
Message has been deleted

Iñigo Quintana

unread,
Jan 26, 2016, 6:48:42 AM1/26/16
to Barman, Backup and Recovery Manager for PostgreSQL
I have seen this in repmgr TODO ( https://github.com/2ndQuadrant/repmgr/blob/master/TODO )

repmgr standby clone: possibility to use barman instead of performing a new base backup

So, even it is not ready from remgr side yet,  could I launch a base backup from Barman to clone existing Master or Standby + restore it  + leave it in recovery mode with get-wal ? 

Whenever I do  a PITR a new timeline is opened and I can not leave the database in continuous recovery mode with the same timeline.

Regards

Iñigo Quintana

unread,
Jan 27, 2016, 4:54:05 AM1/27/16
to Barman, Backup and Recovery Manager for PostgreSQL
Hello,

I have been able to do it (create a new standby(recovery mode) from a previous backup using get-wal). 

1) Do a PITR from barman to get the files: barman recover --remote-ssh-command="ssh postgres@obb"  --target-time "2016-01-27 07:00:00" obl 20160125T171438 /var/lib/postgresql/9.4/main

2) Change the recover.conf generated by Barman to this one
cat recovery.conf 
standby_mode = 'on'
primary_conninfo = 'port=5432 host=obr user=repmgr_usr application_name=node3'  <-- this is tehe master wher slot replication resides
recovery_target_timeline = 'latest'
primary_slot_name = repmgr_slot_3   <- I have created manually in master and not with the "repmgr clone" command.
restore_command = 'ssh barman@obb barman get-wal obl %f > %p'
 
3) postgres.log
2016-01-27 09:19:38 UTC LOG:  restored log file "000000020000000900000062" from archive
2016-01-27 09:19:39 UTC LOG:  restored log file "000000020000000900000063" from archive
ERROR: WAL file '000000020000000900000064' not found in server 'obl'
2016-01-27 09:19:39 UTC LOG:  fetching timeline history file for timeline 2 from primary server
2016-01-27 09:19:39 UTC LOG:  started streaming WAL from primary at 9/63000000 on timeline 2
 

4) register the newly created clone: /usr/lib/postgresql/9.4/bin/repmgr -f /etc/repmgr/node3/repmgr.conf --verbose --force standby register

cat /etc/repmgr/node3/repmgr.conf
 
cluster=test
node=3
node_name=node3
conninfo='host=obb dbname=repmgr_db user=repmgr_usr'
use_replication_slots=1
pg_basebackup_options='--xlog-method=stream'
pg_bindir=/usr/lib/postgresql/9.4/bin
master_response_timeout=60
reconnect_attempts=6
reconnect_interval=10
failover= manual
priority=100 
loglevel=DEBUG
promote_command='repmgr standby promote -f /etc/repmgr/node3/repmgr.conf'
follow_command='repmgr standby follow -f /etc/repmgr/node3/repmgr.conf'
 
 

Best regards
Reply all
Reply to author
Forward
0 new messages