Skip to content

Commit 0803a3a

Browse files
committed
doc: add backup_cron in English.
1 parent 2c9b73f commit 0803a3a

File tree

2 files changed

+93
-20
lines changed

2 files changed

+93
-20
lines changed

docs/en-us/backup_cron.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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 * * * * |

docs/zh-cn/backup_cron.md

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
目录
22
=============
3+
- [简介](#简介)
4+
- [定时备份配置方式](#定时备份配置方式)
5+
- [Cron 表达式格式](#cron-表达式格式)
6+
- [特殊字符](#特殊字符)
7+
- [预定义时间表](#预定义时间表)
38

49
# 简介
5-
目前,无论 S3 还是 NFS 备份,均支持定时备份,并支持使用 crontab 表达式来指定备份的时间策略。您只需直接在集群的 YAML 文件的 `spec` 下设置 `backupSchedule` 字段。例如:
10+
目前,无论 S3 还是 NFS 备份,均支持定时备份,并支持使用 Cron 表达式来指定备份的时间策略。您只需直接在集群的 YAML 文件的 `spec` 下设置 `backupSchedule` 字段。例如:
611

712
```yaml
813
...
@@ -14,19 +19,19 @@ spec:
1419
```
1520
# 定时备份配置方式
1621

17-
## cron 表达式格式
22+
## Cron 表达式格式
1823

19-
cron 表达式的格式为: `[秒] [分] [时] [日] [月] [星期]`即由6个使用空格分隔的字段组成的时间组合
24+
Cron 表达式的格式为: `[秒] [分] [时] [日] [月] [星期]`即由 6 个使用空格分隔的字段组成的时间组合
2025

2126

22-
字段名 | 必配 | 允许值 | 允许的特殊符号
23-
---------- | ---------- | -------------- | --------------------------
24-
| 是 | 0-59 | * / , -
25-
| 是 | 0-59 | * / , -
26-
| 是 | 0-23 | * / , -
27-
日 | 是 | 1-31 | * / , - ?
28-
| 是 | 1-12 or JAN-DEC | * / , -
29-
星期 | 是 | 0-6 or SUN-SAT | * / , - ?
27+
| 字段名 | 必配 | 允许值 | 允许的特殊符号 |
28+
| ------ | ---- | --------------- | -------------- |
29+
| || 0-59 | * / , - |
30+
| || 0-59 | * / , - |
31+
| || 0-23 | * / , - |
32+
| || 1-31 | * / , - ? |
33+
| || 1-12 JAN-DEC | * / , - |
34+
| 星期 || 0-6 SUN-SAT | * / , - ? |
3035

3136
> 注意:```星期` 字段值大小写不敏感,即 `SUN`, `Sun`, 和 `sun` 均接受。
3237
@@ -51,14 +56,14 @@ cron 表达式的格式为: `[秒] [分] [时] [日] [月] [星期]`,即由6
5156

5257
不指定值,仅日期和星期域支持该字符。当日期或星期域其中之一被指定了值以后,为了避免冲突,需要将另一个域的值设为`?`
5358

54-
@ 符号
59+
### 预定义时间表
5560

56-
你可以用如下的预定义时间来代替 cron 表达式。
61+
你可以用如下的预定义时间来代替 Cron 表达式。
5762

58-
值 | 描述 | 等同于
59-
----- | ----------- | -------------
60-
@yearly(或 @annually) | 每年执行一次,在 1 月 1 日夜晚 12 点执行 | 0 0 0 1 1 *
61-
@monthly | 每月执行一次,在每月第 1 天 夜晚 12 点执行 | 0 0 0 1 * *
62-
@weekly | 每周执行一次,在周六和周日之间的夜晚 12 点执行 | 0 0 0 * * 0
63-
@daily(或 @midnight) | 每日执行一次,在夜晚 12 点执行 | 0 0 0 * * *
64-
@hourly | 每小时执行一次,在第 1 分钟执行 | 0 0 * * * *
63+
| | 描述 | 等同于 |
64+
| ----------------------- | ---------------------------------------------- | ----------- |
65+
| @yearly(或 @annually| 每年执行一次,在 1 月 1 日夜晚 12 点执行 | 0 0 0 1 1 * |
66+
| @monthly | 每月执行一次,在每月第 1 天 夜晚 12 点执行 | 0 0 0 1 * * |
67+
| @weekly | 每周执行一次,在周六和周日之间的夜晚 12 点执行 | 0 0 0 * * 0 |
68+
| @daily(或 @midnight| 每日执行一次,在夜晚 12 点执行 | 0 0 0 * * * |
69+
| @hourly | 每小时执行一次,在第 1 分钟执行 | 0 0 * * * * |

0 commit comments

Comments
 (0)