liveBook · Manning

Retention policy

As explained in MongoDB 8.0 in Action, Third Edition

A retention policy defines how long backup copies or recovery data are preserved.

A retention policy determines how long backup snapshots remain available for recovery. In Atlas Cloud Backup, it works alongside the snapshot schedule: the schedule determines when copies are taken, while retention determines how long they are kept. Longer retention can support recovery and compliance needs. section 21.1.1 section 21.5

For a dedicated M10-or-higher cluster, inspect the current schedule with `atlas backups schedule describe <cluster-name>`. Read each row’s frequency and retention together; this command describes the settings rather than changing them. section 21.1.1

CLUSTER NAME           AUTO EXPORT ENABLED   NEXT SNAPSHOT
MongoDB-in-Action-M10  false                 2024-06-22 14:49:20 +0000 UTC

ID   Frequency Interval  Frequency Type   Retention Value  Retention Unit
6676900fe259a12fa8ccfc73   6        hourly           7                days
6676900fe259a12fa8ccfc74   1        daily            7                days
6676900fe259a12fa8ccfc75   6        weekly           4                weeks
6676900fe259a12fa8ccfc76   40       monthly          12               months
6676900fe259a12fa8ccfc77   12       yearly           1                years

This example schedule lists hourly, daily, weekly, monthly, and yearly snapshots with separate retention values and units. For example, its hourly snapshots are retained for seven days. section 21.1.1

Choose the backup approach before relying on a retention window:

  • Dedicated M10-or-higher clusters support scheduled snapshots with configurable retention and on-demand snapshots. Continuous cloud backup offers point-in-time recovery within a configured retention window, with possible additional cost. section 21.5
  • Flex Cloud Backup is limited to automatic daily snapshots; M0 clusters cannot use Atlas Cloud Backup. Manual `mongodump` backups are an alternative for M0, but Atlas does not support its `--oplog` option for point-in-time captures. section 21.1.1 section 21.5
  • Do not treat Atlas Online Archive as a backup retention policy. Its rules address access patterns and retention requirements for lower-cost storage, not recovery after data loss or corruption. section 17.0

How MongoDB 8.0 in Action, Third Edition covers it

How deep it goes
Shows schedule output with separate frequency and retention columns, but does not supply a command for changing retention settings.
Examples
Displays an Atlas CLI schedule with hourly through yearly snapshots and their retention values.
What you can do after
Operate/configure it by inspecting an Atlas backup schedule and distinguishing snapshot retention from a point-in-time recovery window.
How it connects
Links retention policies to snapshot schedules, point-in-time recovery, cloud backup, and Atlas Online Archive.

Also explained in

Compare how 10 books explain retention policy →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of MongoDB 8.0 in Action, Third Edition. The section links point to the parts of the book it draws on.