The use case is a production Proxmox server sending incremental backups via pbs to a remote datastore on another Proxmox backup server.
The other Proxmox backup server would act as a hot standby ( couldn’t be as synchronized as https://pve.proxmox.com/wiki/Storage_Replication, due to longer restore times). In case of downtime of the production server, the failover IPs should be rerouted to the hot standby server.
This is a stub script that is supposed to run on cron.
cat pbs_continuous_restore.pl
Any suggestions to move on are more than welcome. Thanks!
The other Proxmox backup server would act as a hot standby ( couldn’t be as synchronized as https://pve.proxmox.com/wiki/Storage_Replication, due to longer restore times). In case of downtime of the production server, the failover IPs should be rerouted to the hot standby server.
This is a stub script that is supposed to run on cron.
cat pbs_continuous_restore.pl
Perl:
#!/usr/bin/perl
# by EuroDomenii - MIT - 2020
use strict;
use warnings;
sub uniq {
my %seen;
grep !$seen{$_}++, @_;
}
#ToDo execute only when there's no other restore task running, via proxmox-backup-client task list
#ToDo Setup --repository workflow.
#Temporary manual setup sample: export PBS_REPOSITORY="root@pam@localhost:store2"
my @vmids = `proxmox-backup-client snapshots --output-format=json-pretty | jq '.[] | ."backup-id"'`;
my @filtered = uniq(@vmids);
foreach my $i (@filtered) {
chomp $i;
my @timestamps = `proxmox-backup-client snapshots --output-format=json-pretty | jq -r '.[] | select(."backup-id" == $i) | ."backup-time"'`;
my @sorted = sort @timestamps;
my $latest = pop @sorted;
my $backup_type = `proxmox-backup-client snapshots --output-format=json-pretty | jq -r '.[] | select(."backup-id" == $i and ."backup-time" == $latest) | ."backup-type"'`;
print "ID $i LATEST timestamp $latest for backup type $backup_type";
#ToDo FeatureRequest: It would be helpful if the output format json-pretty would provide out of the box a snapshot field like text format, in order to avoid reconstruction
#WIP restore
#Todo format date with T and Z
#my $date = `date -u -d @$latest +'%Y-%m-%d %H:%M:%S'`;
#proxmox-backup-client restore $backup_type/$i/$date index.json -
#or maybe qmrestore
#Asked here https://forum.proxmox.com/threads/pbs-restore-proxmox-kvm-from-cli.73163/
}
Any suggestions to move on are more than welcome. Thanks!
Last edited: