You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Backups schedule is defined in the `backup` section of the Custom
5
-
Resource and can be configured via the [deploy/cr.yaml :octicons-link-external-16:](https://github.com/percona/percona-server-mysql-operator/blob/v{{release}}/deploy/cr.yaml)
6
-
file.
3
+
Scheduled backups run automatically at times you specify. You configure them in the `backup` section of your Custom Resource using the [deploy/cr.yaml :octicons-link-external-16:](https://github.com/percona/percona-server-mysql-operator/blob/v{{release}}/deploy/cr.yaml) file.
7
4
8
-
1. The `backup.storages` subsection should contain at least one [configured storage](backups-storage.md).
5
+
Before setting up scheduled backups, make sure you have at least one [configured storage](backups-storage.md) in the `backup.storages` subsection.
9
6
10
-
2. The `backup.schedule` subsection allows to actually schedule backups:
7
+
## Configure a backupschedule
11
8
12
-
* set the `backup.schedule.name` key to some arbitrary backup name (this name
13
-
will be needed later to [restore the backup](backups-restore.md)).
9
+
To schedule backups, specify the following configuration in your Custom Resource:
14
10
15
-
* specify the `backup.schedule.schedule` option with the desired backup
16
-
schedule in [crontab format :octicons-link-external-16:](https://en.wikipedia.org/wiki/Cron).
11
+
1. Enable backup by setting `backup.enabled` to `true`.
12
+
2. Add entries to the `backup.schedule` subsection in your Custom Resource. Each schedule entry requires the following:
17
13
18
-
* set the `backup.schedule.storageName` key to the name of your [already configured storage](backups-storage.md).
14
+
*`name` - a unique name for this backup schedule
15
+
*`schedule` - the backup schedule in [crontab format :octicons-link-external-16:](https://en.wikipedia.org/wiki/Cron). For example, `"0 0 * * 6"` runs every Saturday at midnight.
16
+
*`storageName` - the name of your [configured storage](backups-storage.md) where backups will be stored
17
+
*`keep` (optional) - the number of backups to keep in storage. Older backups are automatically deleted when this limit is reached.
19
18
20
-
* you can optionally set the `backup.schedule.keep` key to the number of
21
-
backups which should be kept in the storage.
22
-
23
-
Here is an example of the `deploy/cr.yaml` with a scheduled Saturday night
24
-
backup kept on the Amazon S3 storage:
19
+
Here's an example configuration that creates a backup every Saturday night at midnight and keeps the last 3 backups:
25
20
26
21
```yaml
27
22
...
28
23
backup:
24
+
enabled: true
29
25
storages:
30
26
s3-us-west:
31
27
type: s3
32
28
s3:
33
29
bucket: S3-BACKUP-BUCKET-NAME-HERE
34
30
region: us-west-2
35
-
credentialsSecret: my-cluster-name-backup-s3
31
+
credentialsSecret: ps-cluster1-s3-credentials
36
32
schedule:
37
33
- name: "sat-night-backup"
38
34
schedule: "0 0 * * 6"
@@ -43,56 +39,82 @@ backup:
43
39
44
40
## Managing multiple backup schedules in the same storage
45
41
46
-
You can define multiple backup schedules to meet different recovery and compliance needs. For example, create daily backups for quick recovery from recent changes and monthly backups for long-term retention or audit purposes.
47
-
48
-
When using the same storage location for multiple schedules, be aware of these important considerations:
42
+
You can define multiple backup schedules to meet different recovery and compliance needs. For example, you might want daily backups for quick recovery from recent changes and monthly backups for long-term retention or audit purposes.
49
43
50
-
1.**Retention policy conflicts.** The Operator only applies retention policies to the first schedule in your configuration. For example, if you set daily backups to keep 5 copies and monthly backups to keep 3 copies, the Operator will only keep 5 total backups in storage, not 8 as you might expect. However, all backup objects will still appear in `kubectl get ps-backup` output.
44
+
When you use the same storage location for multiple schedules, be aware of these important limitations:
51
45
52
-
2.**Concurrent backup conflicts.** When multiple schedules run simultaneously and write to the same storage path, backups can overwrite each other, resulting in incomplete or corrupted data.
46
+
1.**Retention policy conflicts**: The Operator only applies retention policies to the first schedule in your configuration. For example, if you set daily backups to keep 5 copies and monthly backups to keep 3 copies, the Operator will only keep 5 total backups in storage, not 8 as you might expect. However, all backup objects will still appear in `kubectl get ps-backup` output.
53
47
54
-
To avoid these issues and ensure each schedule maintains its own retention policy, configure separate storage locations for each schedule.
48
+
2.**Concurrent backup conflicts**: When multiple schedules run at the same time and write to the same storage path, backups can overwrite each other, resulting in incomplete or corrupted data.
55
49
56
-
The configuration steps are the following:
50
+
To avoid these issues and ensure each schedule maintains its own retention policy, configure separate storage locations for each schedule. Here's how:
57
51
58
52
1. Create separate storage configurations in your Custom Resource with different names
59
53
2. Specify unique buckets or prefixes for each storage configuration
60
54
3. Assign different storage names to specific schedules
To find all backups created by a specific schedule, use the `percona.com/backup-ancestor` label. The label format is `percona.com/backup-ancestor: <hash>-<schedule-name>`, where `<hash>` is a unique identifier and `<schedule-name>` is the name you specified in your schedule configuration.
97
109
110
+
For example, to find all backups created by the `sat-night-backup` schedule:
98
111
112
+
```bash
113
+
kubectl get ps-backup -l percona.com/backup-ancestor -n <namespace>
114
+
```
115
+
116
+
Or to filter for a specific schedule:
117
+
118
+
```bash
119
+
kubectl get ps-backup -l percona.com/backup-ancestor=0ed1d-sat-night-backup -n <namespace>
0 commit comments