Backup planning

Hello there,

I installed and configured Percona Backup for MongoDB, I did some backup and restore tests with physical, incremental e logical type of backup, including the PITR incremental to true.

I would like to know how can I plan a backup strategy including the retention, an example as I would need the following:

  • full backup every week on sunday, with 35 days of retention
  • incremental backup from monday to saturday, with 32 days of retention
  • PITR incremental backup every 15 minutes, with 24 hours of retention
  • full month backup, with 13 months of retention
  • full year backup, with 7 years of retention

Thank you in advance to all will reply.

Hello Enrico,

We usually configure backup generation and cleanup using cron jobs.

You can add as many entries as necessary in your crontab configuration, for instance:

full backup every week on sunday: 
0 0 * * SUN percona . /etc/sysconfig/pbm-cron; /usr/bin/pbm backup --type incremental --base  >> /var/log/percona/pbm_bkp.log 2>&1

The line above runs backup every Sunday at 00:00

with 35 days of retention >> This can be done with pbm delete-backup command:

0 6 * * * percona . /etc/sysconfig/pbm-cron; /usr/bin/pbm delete-backup -f --older-than $(date -d '-35 day' +\%Y-\%m-\%d) >> /var/log/percona/pbm_remove_old_backups.log 2>&1

Incremental backups can be scheduled in a similar way, but you need to remove the --base flag

PITR oplog slices can be deleted with pbm delete-pitr command:

As to the frequency of oplog slice generation, I believe you need to set this parameter in your pbm configuration:

We advise you to always test your backup restore process considering all disaster recovery scenarios.
Please let us know if our advise works for you.


Hi arlindo.neto,

Thanks for the detailed explanation of cron and pbm abilities.

But You ignored the last part of the question:

  • full month backup, with 13 months of retention
  • full year backup, with 7 years of retention

Do you have any recommendations here?
Or the only recommendation would be to use custom scripts which will just copy the backups from folder to folder? But then pbm will not see them.