Backup policies
Database backup policies automate backup creation and backup retention as part of an enterprise’s data protection strategy. Policies define rules that give users granular control over database backups, enabling them to achieve the desired recovery point objective (RPO).
Frequency
Each policy defines the schedule at which regular backups are taken using Cron format
Caution
Multiple policies with the same or overlapping frequencies matching the same database will try to schedule backups simultaneously. Only one of the backups will succeed and the other will be reported as missed. For more information on missed backups, see List missed backups by policy
Targets selection
A single backup policy matches one or multiple target databases. Target databases are matched by defining scope, SLA, service tier, and user labels. The target selection is an intersection among all filters.
The scope has the format <organization>/<project>/<database>
which binds to a specific object in the hierarchy of NuoDBaaS objects (organizations, projects, databases) and expands to the set of databases to backup.
For example, the scope acme/messaging
selects all databases within acme organization and messaging project.
Policies created in one organization may select databases in different organizations as long as the user has sufficient access privileges to define a policy with a scope wider than a single organization.
Backup retention
NuoDBaaS enforces the configured retention for regular backups to meet the RPO. By default, all backups are retained indefinitely, however, you can define high-level rules for keeping only certain backups.
Backup rotation scheme
The Grandfather-father-son (GFS) backup scheme is a data retention strategy designed to protect critical data through a hierarchical data backup method. GFS backup rotation happens cyclically, with each backup occurring at the scheduled time repeatedly. Users configure the number of backups to retain from each cycle.
The available cycles are hourly
, daily
, weekly
, monthly
, and yearly
.
For example, 7 daily
means that up to seven daily backups with the last seven days will be retained.
A daily backup is any completed backup requested during the same day.
The period for different cycles can overlap to increase the backup coverage.
Example
The diagrams below illustrate an example retention configuration and the backups that are retained for different cycles. User configured backup policy to retain 3 daily, 4 weekly, 6 montly and 2 yearly backups. Assuming that today is July 18th, 2024, the retained backups from the last year are shown below.
- Daily backups in orange
- Weekly backups in blue
- Monthly backups in red
- Yearly backups in green
By default, weekly backups are chosen on Sunday, monthly on the first day of the month, and yearly on the first day of the year.
The backup rotation scheme is fine-tuned based on the user’s preferences using the retention.settings
backup policy field.
As time passes, new backups for each cycle are retained and those outside of the time range are deleted. For example, once a daily backup is taken on July 19th, the one from July 16th will be automatically deleted. By default, the rotation scheme is applied relative to the last successful backup, if any.
Retain a backup
To prevent a specific backup from being deleted by the backup rotation scheme and keep it forever, add a special label to the backup object with the key keep-forever
and value true
.
Create a backup policy
Create a backup policy that schedules backups every day for all databases in organization acme
, and project messaging
.
List databases for a policy
List all the databases that a policy matches.
List backups for a policy
List all the backups scheduled by a backup policy.
List missed backups by policy
In certain cases, it might not be possible for a policy to schedule a backup on time For example:
- The NuoDBaaS operator is not running
- The target database is disabled
- A backup for this database was taken at the same time
List all missed backups for the policy from the last schedule that had missed backups.
Example output:
Suspend and resume a policy
A backup policy can be temporarily suspended, ensuring no new backups are scheduled.
Edit the suspended
field to suspend or resume a backup policy.
Note
Backups from a suspended policy are not recorded as missed backups.