diff --git a/README.md b/README.md index 754dd9b3..05164c71 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,9 @@ # What is RadonDB MySQL -**RadonDB MySQL** is an open-source, cloud-native, and high-availability cluster solution based on MySQL. It supports the architecture of one leader node and multiple replicas, with a set of management functions for security, automatic backup, monitoring and alarming, automatic scaling, and so on. +**RadonDB MySQL** is an open-source, cloud-native, and high-availability cluster solution based on MySQL. It adopts the architecture of one leader node and multiple replicas, with management capabilities for security, automatic backups, monitoring and alerting, automatic scaling, and so on. -**RadonDB MySQL Kubernetes** supports installation, deployment and management of RadonDB MySQL clusters on [Kubernetes](https://kubernetes.io/), [KubeSphere](https://kubesphere.com.cn/) and [Rancher](https://rancher.com), and automates tasks involved in running a RadonDB MySQL cluster. +**RadonDB MySQL Kubernetes** supports installation, deployment and management of RadonDB MySQL clusters on [Kubernetes](https://kubernetes.io/), [KubeSphere](https://kubesphere.com.cn/) and [Rancher](https://rancher.com), and automates tasks involved in running RadonDB MySQL clusters. ## Features 🧠 **High-availability MySQL**: Automatic decentralized leader election, failover within seconds, and strong data consistency in cluster switching @@ -32,7 +32,7 @@ 💻 **Monitoring and alerting** -✍️ [**Backup for S3**](docs/en-us/deploy_backup_restore_s3.md) +✍️ [**S3 backups**](docs/en-us/backup_and_restoration_s3.md) and [**NFS backups**](docs/en-us/backup_and_restoration_nfs.md) 🎈 **Log management** diff --git a/README_zh.md b/README_zh.md index 619816f2..4bcec465 100644 --- a/README_zh.md +++ b/README_zh.md @@ -32,7 +32,7 @@ 💻 [**监控告警**](docs/zh-cn/deploy_monitoring.md) -✍️ [**备份**](docs/zh-cn/deploy_backup_restore_s3.md) +✍️ [**S3 备份**](docs/zh-cn/backup_and_restoration_s3.md)和 [**NFS 备份**](docs/zh-cn/backup_and_restoration_nfs.md) 🎈 **集群日志管理** diff --git a/docs/en-us/deploy_backup_restore_nfs.md b/docs/en-us/backup_and_restoration_nfs.md similarity index 90% rename from docs/en-us/deploy_backup_restore_nfs.md rename to docs/en-us/backup_and_restoration_nfs.md index 7276327e..76c1dfff 100644 --- a/docs/en-us/deploy_backup_restore_nfs.md +++ b/docs/en-us/backup_and_restoration_nfs.md @@ -1,4 +1,4 @@ -English | [简体中文](../zh-cn/deploy_backup_restore_nfs.md) +English | [简体中文](../zh-cn/backup_and_restoration_nfs.md) # Quickstart for NFS backups @@ -31,7 +31,7 @@ In this way, you can install the Pod and Service of the NFS server in the cluste ### 2. Install by kubectl ```shell kubectl apply -f config/samples/nfs_pv.yaml - kubectl apply -f config/samples/nfs_server.yaml +kubectl apply -f config/samples/nfs_server.yaml ``` ## Obtain `nfsServerAddress` @@ -75,7 +75,7 @@ Configure the `nfsServerAddress` attribute to the NFS server address in the `mys nfsServerAddress: 10.96.253.82 ``` - > Notice: `restoreFrom` stands for the pathname of the backup. You can get it by checking the path loaded by the NFS server. + > Notice: `restoreFrom` stands for the path name of the backup. You can get it by checking the path loaded by the NFS server. Restore cluster from NFS backup as follows. diff --git a/docs/en-us/deploy_backup_restore_s3.md b/docs/en-us/backup_and_restoration_s3.md similarity index 82% rename from docs/en-us/deploy_backup_restore_s3.md rename to docs/en-us/backup_and_restoration_s3.md index ec7fd05b..6641d3b0 100644 --- a/docs/en-us/deploy_backup_restore_s3.md +++ b/docs/en-us/backup_and_restoration_s3.md @@ -1,11 +1,12 @@ -English | [简体中文](../zh-cn/deploy_backup_restore_s3.md) +English | [简体中文](../zh-cn/backup_and_restoration_s3.md) -Contents -============= +# Quickstart for S3 backups + +## Contents - [Prerequisites](#Prerequisites) - [Overview](#Overview) - - [Configure the backup for S3](#Configure-the-backup-for-S3) + - [Configure the backup](#Configure-the-backup) - [Step 1: Create the Secret file](#Step-1-Create-the-Secret-file) - [Step 2: Configure the Secret for the Operator cluster](#Step-2-Configure-the-Secret-for-the-Operator-cluster) - [Start the backup](#Start-the-backup) @@ -17,7 +18,7 @@ Contents ## Overview This tutorial displays how to back up and restore the deployed RadonDB MySQL Operator cluster. -## Configure the S3 backup +## Configure the backup ### Step 1: Create the Secret file ```yaml @@ -44,7 +45,7 @@ Then, create the backup Secret. kubectl create -f config/samples/backup_secret.yaml ``` -### Step 2: Configure the Secret for the Operator cluster +### Step 2: Configure the backup Secret for the Operator cluster Configure the `backupSecretName` property in `mysql_v1alpha1_mysqlcluster.yaml`, for example, `sample-backup-secre`. ```yaml @@ -67,14 +68,14 @@ spec: clusterName: sample ``` -| Name | Description | -|------|--------| -|hostName|pod name in cluser| -|clusterName|cluster name| +| Parameter | Description | +| ----------- | ------------ | +| hostName | Pod name | +| clusterName | Cluster name | ## Start the backup -Before starting backup, you need to start the cluster. +Before starting the backup, you need to start the cluster. ```shell kubectl apply -f config/samples/mysql_v1alpha1_backup.yaml @@ -89,7 +90,7 @@ backup-sample sample_2022526155115 2022-05-26T15:51:15 S3 ``` ## Restore the cluster from the backup -Check the S3 bucket and set the `RestoreFrom` property in the `mysql_v1alpha1_backup.yaml` file to the backup directory, for example, `sample_2022526155115`. +Check the S3 bucket and set the `RestoreFrom` property in the `mysql_v1alpha1_mysqlcluster.yaml` file to the backup directory, for example, `sample_2022526155115`. ```yaml ... diff --git a/docs/en-us/backup_cron.md b/docs/en-us/backup_cron.md new file mode 100644 index 00000000..a5b3448b --- /dev/null +++ b/docs/en-us/backup_cron.md @@ -0,0 +1,68 @@ +Contents +============= +- [Overview](#overview) +- [Configuration of scheduled backups](#configuration-of-scheduled-backups) + - [Cron expression format](#cron-expression-format) + - [Special characters](#special-characters) + - [Predefined schedules](#predefined-schedules) + +# Overview +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: + +```yaml +... +spec: + replicas: 3 + mysqlVersion: "5.7" + backupSchedule: "0 0 0 * * *" # daily + ... +``` +# Configuration of scheduled backups + +## Cron expression format + +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]`. + +| Field name | Mandatory | Allowed values | Allowed special characters | +| ------------ | --------- | --------------- | -------------------------- | +| Seconds | Yes | 0-59 | * / , - | +| Minutes | Yes | 0-59 | * / , - | +| Hours | Yes | 0-23 | * / , - | +| Day of month | Yes | 1-31 | * / , - ? | +| Month | Yes | 1-12 or JAN-DEC | * / , - | +| Day of week | Yes | 0-6 or SUN-SAT | * / , - ? | + +> Note: `Month` and `Day-of-week` field values are case-insensitive. `SUN`, `Sun`, and `sun` are equally accepted. + +### Special characters +Asterisk ( * ) + +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. + +Slash ( / ) + +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. + +Comma ( , ) + +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. + +Hyphen ( - ) + +Hyphens are used to define ranges. For example, `9-17` would indicate every hour between 9am and 5pm inclusive. + +Question mark ( ? ) + +Question mark may be used instead of `*` for leaving either day-of-month or day-of-week blank. + +### Predefined schedules + +You may use one of several pre-defined schedules in place of a cron expression. + +| Entry | Description | Equivalent To | +| ---------------------- | ------------------------------------------ | ------------- | +| @yearly (or @annually) | Run once a year, midnight, Jan. 1st | 0 0 0 1 1 * | +| @monthly | Run once a month, midnight, first of month | 0 0 0 1 * * | +| @weekly | Run once a week, midnight on Sunday | 0 0 0 * * 0 | +| @daily (or @midnight) | Run once a day, midnight | 0 0 0 * * * | +| @hourly | Run once an hour, beginning of hour | 0 0 * * * * | \ No newline at end of file diff --git a/docs/zh-cn/deploy_backup_restore_nfs.md b/docs/zh-cn/backup_and_restoration_nfs.md similarity index 97% rename from docs/zh-cn/deploy_backup_restore_nfs.md rename to docs/zh-cn/backup_and_restoration_nfs.md index 8d8abf36..8b76158f 100644 --- a/docs/zh-cn/deploy_backup_restore_nfs.md +++ b/docs/zh-cn/backup_and_restoration_nfs.md @@ -1,4 +1,4 @@ -[English](../en-us/deploy_backup_restore_nfs.md) | 简体中文 +[English](../en-us/backup_restoration_nfs.md) | 简体中文 # NFS 备份快速手册 diff --git a/docs/zh-cn/deploy_backup_restore_s3.md b/docs/zh-cn/backup_and_restoration_s3.md similarity index 61% rename from docs/zh-cn/deploy_backup_restore_s3.md rename to docs/zh-cn/backup_and_restoration_s3.md index dc1b3a25..2f3e4375 100644 --- a/docs/zh-cn/deploy_backup_restore_s3.md +++ b/docs/zh-cn/backup_and_restoration_s3.md @@ -1,13 +1,13 @@ -[English](../en-us/deploy_backup_restore_s3.md) | 简体中文 +[English](../en-us/backup_restoration_s3.md) | 简体中文 -目录 -============= +# S3 备份快速手册 +## 目录 - [前提条件](#前提条件) - [简介](#简介) - - [配置 backup](#配置-backup) - - [步骤 1: 添加 Secret 文件](#1-添加-secret-文件) - - [步骤 2: 将 Secret 配置到 Operator 集群](#2-将-secret-配置到-Operator-集群) + - [配置备份](#配置备份) + - [步骤 1: 添加 Secret 文件](#步骤-1-添加-secret-文件) + - [步骤 2: 将 Secret 配置到 Operator 集群](#步骤-2-将-secret-配置到-operator-集群) - [启动备份](#启动备份) - [从备份副本恢复到新集群](#从备份副本恢复到新集群) @@ -19,9 +19,9 @@ 本文档介绍如何对部署的 RadonDB MySQL Operator 集群进行备份和恢复。 -## 配置 backup +## 配置备份 -### 步骤 1: 添加 Secret 文件 +### 步骤 1: 创建 Secret 配置文件 ```yaml kind: Secret apiVersion: v1 @@ -36,17 +36,17 @@ data: type: Opaque ``` -s3-xxxx 值用 base64 编码,注意不要把换行符编码进去,可以用如下命令获取 base64 编码: +`s3-xxxx` 字段的值采用 base64 编码,注意不要包含换行符的编码。您可以用如下命令获取 base64 编码: ``` echo -n "替换为您的S3-XXX值"|base64 ``` -随后,用如下命令创建备份 Secret: +然后,使用如下命令创建备份 Secret: ``` kubectl create -f config/samples/backup_secret.yaml ``` ### 步骤 2: 将 Secret 配置到 Operator 集群 -将备份 Secret 名称添加到 mysql_v1alpha1_mysqlcluster.yaml 中,本例中名称为 sample-backup-secret: +将备份 Secret 名称添加到 `mysql_v1alpha1_mysqlcluster.yaml` 中,本例中的名称为 `sample-backup-secret`: ```yaml spec: @@ -55,7 +55,7 @@ spec: backupSecretName: sample-backup-secret ... ``` -如下创建备份YAML文件`mysql_v1alpha1_backup`.yaml: +如下创建备份 YAML 配置文件 `mysql_v1alpha1_backup.yaml`: ```yaml apiVersion: mysql.radondb.com/v1alpha1 @@ -68,10 +68,10 @@ spec: clusterName: sample ``` -| 参数名 | 描述 | -|------|--------| -|hostName| 集群中Pod的名称 | -|clusterName| 数据库集群名称 | +| 参数名 | 描述 | +| ----------- | --------------- | +| hostName | 集群中 Pod 的名称 | +| clusterName | 数据库集群名称 | ## 启动备份 @@ -79,7 +79,7 @@ spec: ```shell kubectl apply -f config/samples/mysql_v1alpha1_backup.yaml ``` -执行成功后,可以通过如下命令查看备份状况 +执行成功后,可以通过如下命令查看备份状况: ``` kubectl get backups.mysql.radondb.com NAME BACKUPNAME BACKUPDATE TYPE @@ -87,8 +87,8 @@ backup-sample sample_2022526155115 2022-05-26T15:51:15 S3 ``` ## 从备份副本恢复到新集群 -检查您的 S3 bucket,得到您需要的备份文件夹如 `sample_2022526155115`。 -添加 RestoreFrom 字段到 mysql_v1alpha1_backup.yaml 中,如下: +检查您的 S3 bucket,得到您需要的备份文件夹,如 `sample_2022526155115`。 +在 `mysql_v1alpha1_mysqlcluster.yaml` 中添加 `RestoreFrom` 字段,如下: ```yaml ... diff --git a/docs/zh-cn/backup_cron.md b/docs/zh-cn/backup_cron.md index f026a2e9..580a06d0 100644 --- a/docs/zh-cn/backup_cron.md +++ b/docs/zh-cn/backup_cron.md @@ -1,8 +1,13 @@ 目录 ============= +- [简介](#简介) +- [定时备份配置方式](#定时备份配置方式) + - [Cron 表达式格式](#cron-表达式格式) + - [特殊字符](#特殊字符) + - [预定义时间表](#预定义时间表) # 简介 -目前,无论 S3 还是 NFS 备份,均支持定时备份,并支持使用 crontab 表达式来指定备份的时间策略。您只需直接在集群的 YAML 文件的 `spec` 下设置 `backupSchedule` 字段。例如: +目前,无论 S3 还是 NFS 备份,均支持定时备份,并支持使用 Cron 表达式来指定备份的时间策略。您只需直接在集群的 YAML 文件的 `spec` 下设置 `backupSchedule` 字段。例如: ```yaml ... @@ -14,19 +19,19 @@ spec: ``` # 定时备份配置方式 -## cron 表达式格式 +## Cron 表达式格式 -cron 表达式的格式为: `[秒] [分] [时] [日] [月] [星期]`,即由6个使用空格分隔的字段组成的时间组合。 + Cron 表达式的格式为: `[秒] [分] [时] [日] [月] [星期]`,即由 6 个使用空格分隔的字段组成的时间组合。 -字段名 | 必配 | 允许值 | 允许的特殊符号 ----------- | ---------- | -------------- | -------------------------- -秒 | 是 | 0-59 | * / , - -分 | 是 | 0-59 | * / , - -时 | 是 | 0-23 | * / , - -日 | 是 | 1-31 | * / , - ? -月 | 是 | 1-12 or JAN-DEC | * / , - -星期 | 是 | 0-6 or SUN-SAT | * / , - ? +| 字段名 | 必配 | 允许值 | 允许的特殊符号 | +| ------ | ---- | --------------- | -------------- | +| 秒 | 是 | 0-59 | * / , - | +| 分 | 是 | 0-59 | * / , - | +| 时 | 是 | 0-23 | * / , - | +| 日 | 是 | 1-31 | * / , - ? | +| 月 | 是 | 1-12 或 JAN-DEC | * / , - | +| 星期 | 是 | 0-6 或 SUN-SAT | * / , - ? | > 注意:`月` 和 `星期` 字段值大小写不敏感,即 `SUN`, `Sun`, 和 `sun` 均接受。 @@ -51,14 +56,14 @@ cron 表达式的格式为: `[秒] [分] [时] [日] [月] [星期]`,即由6 不指定值,仅日期和星期域支持该字符。当日期或星期域其中之一被指定了值以后,为了避免冲突,需要将另一个域的值设为`?`。 -@ 符号 +### 预定义时间表 -你可以用如下的预定义时间来代替 cron 表达式。 +你可以用如下的预定义时间来代替 Cron 表达式。 -值 | 描述 | 等同于 ------ | ----------- | ------------- -@yearly(或 @annually) | 每年执行一次,在 1 月 1 日夜晚 12 点执行 | 0 0 0 1 1 * -@monthly | 每月执行一次,在每月第 1 天 夜晚 12 点执行 | 0 0 0 1 * * -@weekly | 每周执行一次,在周六和周日之间的夜晚 12 点执行 | 0 0 0 * * 0 -@daily(或 @midnight) | 每日执行一次,在夜晚 12 点执行 | 0 0 0 * * * -@hourly | 每小时执行一次,在第 1 分钟执行 | 0 0 * * * * +| 值 | 描述 | 等同于 | +| ----------------------- | ---------------------------------------------- | ----------- | +| @yearly(或 @annually) | 每年执行一次,在 1 月 1 日夜晚 12 点执行 | 0 0 0 1 1 * | +| @monthly | 每月执行一次,在每月第 1 天 夜晚 12 点执行 | 0 0 0 1 * * | +| @weekly | 每周执行一次,在周六和周日之间的夜晚 12 点执行 | 0 0 0 * * 0 | +| @daily(或 @midnight) | 每日执行一次,在夜晚 12 点执行 | 0 0 0 * * * | +| @hourly | 每小时执行一次,在第 1 分钟执行 | 0 0 * * * * | diff --git a/docs/zh-cn/mgt_mysqluser.md b/docs/zh-cn/mgt_mysqluser.md index bbb3c7cf..6b0abcdf 100644 --- a/docs/zh-cn/mgt_mysqluser.md +++ b/docs/zh-cn/mgt_mysqluser.md @@ -15,7 +15,7 @@ * [5.1 Secret](#5.1-Secret) * [5.2 MysqlUser](#5.2-MysqlUser) -# 使用 MysqlUser CRD 管理 MySQL用户 +# 使用 MysqlUser CRD 管理 MySQL 用户 ## 1. 前提条件