Backups in Managed Service for MongoDB
Managed Service for MongoDB supports automatic and manual database backups.
Managed Service for MongoDB allows you to restore the state of a cluster to any point in time (Point-in-Time-Recovery, PITR) between the time you create the oldest backup to the moment when you archive the most recent oplog collection. For this purpose, the backup selected as the starting point of recovery is updated with entries from the cluster oplog.
When creating backups and restoring data from them to a given point in time, keep the following in mind:
-
The oplog is archived in a running cluster a few times a minute, and then uploaded to object storage.
-
It takes some time to create and upload an oplog archive to object storage. This is why the cluster state stored in the object storage may differ from the actual one.
To use PITR, the cluster must meet the following criteria:
- MongoDB version in the cluster: 4.2 or higher.
- Sharding: Disabled. PITR works only for a cluster with a single replica set.
To restore a cluster from a backup, follow this guide.
Creating backups
You can create backups both automatically and manually; in both cases, you get a full backup of all databases.
All cluster data is automatically backed up every day. You cannot disable such automatic backups. However, when creating or editing a cluster, you can set the following parameters for automatic backups:
- Retention time.
- Time interval during which the backup starts. The default time is
22:00 - 23:00
UTC (Coordinated Universal Time).
After a backup is created, it is compressed for storage. To find out its exact size, request a list of backups.
Backups are only created on running clusters. If you do not use a Managed Service for MongoDB cluster 24/7, check the backup start time settings.
For more information about creating a backup manually, see Managing backups in Managed Service for MongoDB.
Storing backups
Storing backups in Managed Service for MongoDB:
-
Backups are kept in Yandex internal storage as logical dumps and encrypted with GPG
. Each cluster has its own encryption keys. -
The retention time for backups of an existing cluster depends on the method used to create such backups:
-
After you delete a cluster, all its backups are kept for seven days.
-
Backup storage is not subject to quotas
or limits for cluster storage space. -
Backups are stored in object storage and do not take up space in cluster storage. If there are N free GB of space in the cluster, the storage of the first N GB of backups is free of charge.
For more information, see the Managed Service for MongoDB pricing policy.
Checking backup recovery
To test how backup works, restore a cluster from a backup and check the integrity of your data.