|
| 1 | +Contents |
| 2 | +============= |
| 3 | +- [Overview](#overview) |
| 4 | +- [Configuration of scheduled backups](#configuration-of-scheduled-backups) |
| 5 | + - [Cron expression format](#cron-expression-format) |
| 6 | + - [Special characters](#special-characters) |
| 7 | + - [Predefined schedules](#predefined-schedules) |
| 8 | + |
| 9 | +# Overview |
| 10 | +The scheduled backup is currently supported for both S3 and NFS backups. You can use the cron expression to specify the backup schedule. Set the `backupSchedule` parameter under the `spec` field in the YAML file of the cluster, for example: |
| 11 | + |
| 12 | +```yaml |
| 13 | +... |
| 14 | +spec: |
| 15 | + replicas: 3 |
| 16 | + mysqlVersion: "5.7" |
| 17 | + backupSchedule: "0 0 0 * * *" # daily |
| 18 | + ... |
| 19 | +``` |
| 20 | +# Configuration of scheduled backups |
| 21 | + |
| 22 | +## Cron expression format |
| 23 | + |
| 24 | +A cron expression represents a set of times, using 6 space-separated fields in the format of `[second] [minute] [hour] [day] [month] [day of week]`. |
| 25 | + |
| 26 | +| Field name | Mandatory | Allowed values | Allowed special characters | |
| 27 | +| ------------ | --------- | --------------- | -------------------------- | |
| 28 | +| Seconds | Yes | 0-59 | * / , - | |
| 29 | +| Minutes | Yes | 0-59 | * / , - | |
| 30 | +| Hours | Yes | 0-23 | * / , - | |
| 31 | +| Day of month | Yes | 1-31 | * / , - ? | |
| 32 | +| Month | Yes | 1-12 or JAN-DEC | * / , - | |
| 33 | +| Day of week | Yes | 0-6 or SUN-SAT | * / , - ? | |
| 34 | + |
| 35 | +> Note: `Month` and `Day-of-week` field values are case-insensitive. `SUN`, `Sun`, and `sun` are equally accepted. |
| 36 | +
|
| 37 | +### Special characters |
| 38 | +Asterisk ( * ) |
| 39 | + |
| 40 | +The asterisk indicates that the cron expression will match for all values of the field. For example, using an asterisk in the 5th field (month) would indicate every month. |
| 41 | + |
| 42 | +Slash ( / ) |
| 43 | + |
| 44 | +Slashes are used to describe increments of ranges. For example `3-59/15` in the 1st field (minutes) would indicate the 3rd minute of the hour and every 15 minutes thereafter. The form `*\/...` is equivalent to the form `first-last/...`, that is, an increment over the largest possible range of the field. The form `N/...` is accepted as meaning `N-MAX/...`, that is, starting at `N`, use the increment until the end of that specific range. It does not wrap around. |
| 45 | + |
| 46 | +Comma ( , ) |
| 47 | + |
| 48 | +Commas are used to separate items of a list. For example, using `MON,WED,FRI` in the 5th field (day of week) would mean Mondays, Wednesdays and Fridays. |
| 49 | + |
| 50 | +Hyphen ( - ) |
| 51 | + |
| 52 | +Hyphens are used to define ranges. For example, `9-17` would indicate every hour between 9am and 5pm inclusive. |
| 53 | + |
| 54 | +Question mark ( ? ) |
| 55 | + |
| 56 | +Question mark may be used instead of `*` for leaving either day-of-month or day-of-week blank. |
| 57 | + |
| 58 | +### Predefined schedules |
| 59 | + |
| 60 | +You may use one of several pre-defined schedules in place of a cron expression. |
| 61 | + |
| 62 | +| Entry | Description | Equivalent To | |
| 63 | +| ---------------------- | ------------------------------------------ | ------------- | |
| 64 | +| @yearly (or @annually) | Run once a year, midnight, Jan. 1st | 0 0 0 1 1 * | |
| 65 | +| @monthly | Run once a month, midnight, first of month | 0 0 0 1 * * | |
| 66 | +| @weekly | Run once a week, midnight on Sunday | 0 0 0 * * 0 | |
| 67 | +| @daily (or @midnight) | Run once a day, midnight | 0 0 0 * * * | |
| 68 | +| @hourly | Run once an hour, beginning of hour | 0 0 * * * * | |
0 commit comments