Team,
we have a requirement to delete the backups which are older than 10days. I have scheduled it in cronjob, but its not happening.
[mongod@tora-pl211 ~]$ pbm cleanup -y --older-than 10d --wait
nothing to delete
Please let me know if any other command to replace it.
[mongod@tora-pl211 ~]$ pbm status
Cluster:
========
shard3ReplSet:
- shard3ReplSet/pmgo-pl206.int.compumark.com:27018 [S]: pbm-agent v2.2.1 OK
- shard3ReplSet/pmgo-pl205.int.compumark.com:27018 [P]: pbm-agent v2.2.1 OK
- shard3ReplSet/pmgo-pl201.int.compumark.com:27028 [S]: pbm-agent v2.2.1 OK
shard1ReplSet:
- shard1ReplSet/pmgo-pl203.int.compumark.com:27018 [S]: pbm-agent v2.2.1 OK
- shard1ReplSet/pmgo-pl201.int.compumark.com:27018 [P]: pbm-agent v2.2.1 OK
- shard1ReplSet/pmgo-pl202.int.compumark.com:27028 [S]: pbm-agent v2.2.1 OK
configReplSet:
- configReplSet/pmgo-pl204.int.compumark.com:27019 [S]: pbm-agent v2.2.1 OK
- configReplSet/pmgo-pl202.int.compumark.com:27019 [P]: pbm-agent v2.2.1 OK
- configReplSet/pmgo-pl206.int.compumark.com:27029 [S]: pbm-agent v2.2.1 OK
shard2ReplSet:
- shard2ReplSet/pmgo-pl204.int.compumark.com:27018 [S]: pbm-agent v2.2.1 OK
- shard2ReplSet/pmgo-pl202.int.compumark.com:27018 [P]: pbm-agent v2.2.1 OK
- shard2ReplSet/pmgo-pl205.int.compumark.com:27028 [S]: pbm-agent v2.2.1 OK
PITR incremental backup:
========================
Status [ON]
Currently running:
==================
(none)
Backups:
========
S3 us-east-1 s3://cm-mongo-db-shared-prod-va/percona/backup/
Snapshots:
2023-12-16T01:00:03Z 2.28TB <logical> [restore_to_time: 2023-12-16T12:34:09Z]
2023-12-09T01:00:02Z 2.33TB <logical> [restore_to_time: 2023-12-09T13:10:04Z]
2023-12-02T01:00:02Z 2.31TB <logical> [restore_to_time: 2023-12-02T13:10:25Z]
PITR chunks [585.99GB]:
2023-12-02T13:10:26Z - 2023-12-17T12:36:24Z
Hi Aranjith,
What version are you using? For 2.0.5 and older, you should use a timestamp argument to the older-than flag:
For PBM version 2.0.5 and earlier, use the pbm delete backup --older-than <timestamp> command.
You can configure a cron task to automate backup deletion by specifying the following command in the crontab file:
$ /usr/bin/pbm delete-backup -f --older-than $(date -d '-1 month' +\%Y-\%m-\%d)
...
Hi @Agustin_G , we use percona v2.2.1, this version has new feature to delete the backups older than x days irrespective of PITR backups.
my question is why the command “pbm cleanup -y --older-than 10d --wait” doesn’t work in this version.
In older versions(say 2.0.x), we use “pbm delete backup --older-than ” command. but this requires to manually delete pitr first .
Hi @percona ,
Can someone please help, is there a alternative command to delete the backups.
[mongod@tora-pl211 ~]$ pbm cleanup -y --older-than 15d --wait
nothing to delete
[mongod@tora-pl211 ~]$ pbm delete-backup -f --older-than $(date -d ‘-15days’ +%Y-%m-%d);
Waiting for delete to be done …[done]
Backup snapshots:
2024-01-06T01:00:02Z [restore_to_time: 2024-01-06T14:03:15Z]
2024-01-13T01:00:02Z [restore_to_time: 2024-01-13T13:06:20Z]
2024-01-20T01:00:02Z [restore_to_time: 2024-01-20T13:17:01Z]
PITR :
2024-01-06T14:03:16Z - 2024-01-23T13:20:13Z
Log says,
2024-01-23T14:55:19Z I [configReplSet/pmgo-pl202.int.compumark.com:27019] [delete/2024-01-08T00:00:00Z] deleting 2024-01-06T01:00:02Z: unable to delete: backup is a base for ‘2024-01-06T14:03:15 - 2024-01-23T13:20:13’
I believe in recent version, not needed to delete pitr first.