# Backup Retention

**URL:** <https://forums.percona.com/t/backup-retention/29624>\
**Category:** Percona Everest\
**Created:** [April 8, 2024, 3:09pm UTC](https://forums.percona.com/t/backup-retention/29624 "2024-04-08T15:09:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![JayV](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/jayv/32/12200_2.png) [@JayV](https://forums.percona.com/u/JayV)\
**Post date:** [April 8, 2024, 3:09pm UTC](https://forums.percona.com/t/backup-retention/29624/1 "2024-04-08T15:09:58Z")

</div>

Is there a way to specify the retention period for database clusters managed by Everest?

It looks like the `PerconaPGCluster` and underlying `PostgresCluster` CRDs supports configuring this value, but it appears to effectively be hardcoded to `9999999` full backups.

I haven’t noticed a similar setting for `PerconaServerMongoDB` yet (though I haven’t done a ton of digging here).

What options do we have to correctly deal with retention? Is the expectation that we set lifecycle rules on the S3 buckets?

---

<div class="post-metadata">

**Author:** ![Diogo\_Recharte](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/diogo_recharte/32/8004_2.png) [@Diogo\_Recharte](https://forums.percona.com/u/Diogo_Recharte)\
**Post date:** [April 9, 2024, 9:50am UTC](https://forums.percona.com/t/backup-retention/29624/2 "2024-04-09T09:50:18Z")

</div>

Hi @JayV,

Currently, you’re not able to customize this from the Percona Everest UI. [This feature](https://perconadev.atlassian.net/browse/EVEREST-946) is in our roadmap and it’s expected to be delivered in 0.10.0 which will be released at the end of April.

[Our API](https://docs.percona.com/everest-api-doc/) already supports this, so if you really need it right now you may update the Database Cluster spec to match your needs.  
You can do this with a PUT to `/namespaces/{namespace}/database-clusters/{name}`. This request’s payload shall include the complete Database Cluster spec.  
In that payload, you can find a field `.spec.backup.schedules[0].retentionCopies` that you can customize to you needs. Bear in mind that 0 is a special value that means infinite copies. In PostgreSQL (PGBackRest actually), we can’t really have an infinite value so the everest operator translates this 0 to 9999999.

---

<div class="post-metadata">

**Author:** ![JayV](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/jayv/32/12200_2.png) [@JayV](https://forums.percona.com/u/JayV)\
**Post date:** [April 12, 2024, 7:56pm UTC](https://forums.percona.com/t/backup-retention/29624/3 "2024-04-12T19:56:33Z")

</div>

Thanks for the response! It looks like this `retentionCopies` setting works well for our PostgreSQL cluster. I set the same value for a MongoDB cluster, but it does not look like older backups are being pruned from the bucket. Is this expected? Is there a better way to set retention for MongoDB clusters?

---

<div class="post-metadata">

**Author:** ![Diogo\_Recharte](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/diogo_recharte/32/8004_2.png) [@Diogo\_Recharte](https://forums.percona.com/u/Diogo_Recharte)\
**Post date:** [April 16, 2024, 8:42am UTC](https://forums.percona.com/t/backup-retention/29624/4 "2024-04-16T08:42:15Z")

</div>

Hi @JayV, thank you so much for letting us know about this.  
We have done some internal testing and we can confirm this is indeed a bug in our everest operator. We have created [this ticket](https://perconadev.atlassian.net/browse/EVEREST-979) to address this issue.  
I’ll let you know once the fix is released

---

<div class="post-metadata">

**Author:** ![JayV](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/jayv/32/12200_2.png) [@JayV](https://forums.percona.com/u/JayV)\
**Post date:** [April 16, 2024, 11:02am UTC](https://forums.percona.com/t/backup-retention/29624/5 "2024-04-16T11:02:52Z")

</div>

Fantastic! Thank you for digging into the behavior and confirming that I’m not crazy (at least in this singular regard!).

---

<div class="post-metadata">

**Author:** ![silent](https://avatars.discourse-cdn.com/v4/letter/s/f08c70/32.png) [@silent](https://forums.percona.com/u/silent)\
**Post date:** [August 9, 2024, 10:20pm UTC](https://forums.percona.com/t/backup-retention/29624/6 "2024-08-09T22:20:02Z")

</div>

It doesn’t seem to be there in the current version (1.0.1). Will this come to PG clusters soon?

---

<div class="post-metadata">

**Author:** ![Diogo\_Recharte](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/diogo_recharte/32/8004_2.png) [@Diogo\_Recharte](https://forums.percona.com/u/Diogo_Recharte)\
**Post date:** [August 12, 2024, 1:10pm UTC](https://forums.percona.com/t/backup-retention/29624/7 "2024-08-12T13:10:27Z")

</div>

Hi @silent,  
Yes, this option will be available for PG clusters in v1.2.0, expected to be released at the beginning of September.
