Skip to content

Commit

Permalink
zh, en: update BR doc about omitting the spec.from/to when using new …
Browse files Browse the repository at this point in the history
…version (#812)

Signed-off-by: gongmengnan <gong.mengnan@ninjavan.co>
  • Loading branch information
namco1992 authored Nov 10, 2020
1 parent 3f39dc8 commit 32855ae
Show file tree
Hide file tree
Showing 12 changed files with 142 additions and 40 deletions.
28 changes: 23 additions & 5 deletions en/backup-to-aws-s3-using-br.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ Currently, the above three authorization methods are supported for the ad-hoc ba

Before you perform ad-hoc backup, AWS account permissions need to be granted. This section describes three methods to grant AWS account permissions.

> **Note:**
>
> If TiDB Operator >= v1.1.7 && TiDB >= v4.0.8, `tikv_gc_life_time` will be adjusted by BR automatically. You can omit the step that creates the secret which stores the account and password needed to access the TiDB cluster.
#### Grant permissions by importing AccessKey and SecretKey

1. Download [backup-rbac.yaml](https://github.com/pingcap/tidb-operator/blob/master/manifests/backup/backup-rbac.yaml), and execute the following command to create the role-based access control (RBAC) resources in the `test1` namespace:
Expand Down Expand Up @@ -199,6 +203,7 @@ Before you perform ad-hoc backup, AWS account permissions need to be granted. Th
# sendCredToTikv: true
# options:
# - --lastbackupts=420134118382108673
# Only needed for TiDB Operator < v1.1.7 or TiDB < v4.0.8
from:
host: ${tidb_host}
port: ${tidb_port}
Expand Down Expand Up @@ -245,6 +250,7 @@ Before you perform ad-hoc backup, AWS account permissions need to be granted. Th
# checksum: true
# options:
# - --lastbackupts=420134118382108673
# Only needed for TiDB Operator < v1.1.7 or TiDB < v4.0.8
from:
host: ${tidb_host}
port: ${tidb_port}
Expand Down Expand Up @@ -289,6 +295,7 @@ Before you perform ad-hoc backup, AWS account permissions need to be granted. Th
# checksum: true
# options:
# - --lastbackupts=420134118382108673
# Only needed for TiDB Operator < v1.1.7 or TiDB < v4.0.8
from:
host: ${tidb_host}
port: ${tidb_port}
Expand Down Expand Up @@ -342,28 +349,32 @@ kubectl get bk -n test1 -o wide
More `Backup` CR parameter description:

- `.spec.metadata.namespace`: the namespace where the `Backup` CR is located.
- `.spec.tikvGCLifeTime`: the temporary `tikv_gc_lifetime` time setting during the backup. Defaults to 72h.
- `.spec.tikvGCLifeTime`: the temporary `tikv_gc_life_time` time setting during the backup. Defaults to 72h.

Before the backup begins, if the `tikv_gc_lifetime` setting in the TiDB cluster is smaller than `spec.tikvGCLifeTime` set by the user, TiDB Operator adjusts the value of `tikv_gc_lifetime` to the value of `spec.tikvGCLifeTime`. This operation makes sure that the backup data is not garbage-collected by TiKV.
Before the backup begins, if the `tikv_gc_life_time` setting in the TiDB cluster is smaller than `spec.tikvGCLifeTime` set by the user, TiDB Operator adjusts the value of `tikv_gc_life_time` to the value of `spec.tikvGCLifeTime`. This operation makes sure that the backup data is not garbage-collected by TiKV.

After the backup, no matter whether the backup is successful or not, as long as the previous `tikv_gc_lifetime` is smaller than `.spec.tikvGCLifeTime`, TiDB Operator will try to set `tikv_gc_lifetime` to the previous value.
After the backup, no matter whether the backup is successful or not, as long as the previous `tikv_gc_life_time` is smaller than `.spec.tikvGCLifeTime`, TiDB Operator will try to set `tikv_gc_life_time` to the previous value.

In extreme cases, if TiDB Operator fails to access the database, TiDB Operator cannot automatically recover the value of `tikv_gc_lifetime` and treats the backup as failed. At this time, you can view `tikv_gc_lifetime` of the current TiDB cluster using the following statement:
In extreme cases, if TiDB Operator fails to access the database, TiDB Operator cannot automatically recover the value of `tikv_gc_life_time` and treats the backup as failed. At this time, you can view `tikv_gc_life_time` of the current TiDB cluster using the following statement:

{{< copyable "sql" >}}

```sql
select VARIABLE_NAME, VARIABLE_VALUE from mysql.tidb where VARIABLE_NAME like "tikv_gc_life_time";
```
In the output of the command above, if the value of `tikv_gc_lifetime` is still larger than expected (10m by default), it means TiDB Operator failed to automatically recover the value. Therefore, you need to set `tikv_gc_lifetime` back to the previous value manually:
In the output of the command above, if the value of `tikv_gc_life_time` is still larger than expected (10m by default), it means TiDB Operator failed to automatically recover the value. Therefore, you need to set `tikv_gc_life_time` back to the previous value manually:
{{< copyable "sql" >}}
```sql
update mysql.tidb set VARIABLE_VALUE = '10m' where VARIABLE_NAME = 'tikv_gc_life_time';
```
> **Note:**
>
> If TiDB Operator >= v1.1.7 && TiDB >= v4.0.8, `tikv_gc_life_time` will be adjusted by BR automatically, so you can omit `spec.tikvGCLifeTime`.
- * `.spec.cleanPolicy`: The clean policy of the backup data when the backup CR is deleted.
Three clean policies are supported:
Expand All @@ -390,6 +401,10 @@ More `Backup` CR parameter description:
kubectl create secret generic ${secret_name} --namespace=${namespace} --from-file=tls.crt=${cert_path} --from-file=tls.key=${key_path} --from-file=ca.crt=${ca_path}
```
> **Note:**
>
> If TiDB Operator >= v1.1.7 && TiDB >= v4.0.8, `tikv_gc_life_time` will be adjusted by BR automatically, so you can omit `spec.from`.
- `.spec.tableFilter`: BR only backs up tables that match the [table filter rules](https://docs.pingcap.com/tidb/stable/table-filter/). This field can be ignored by default. If the field is not configured, BR backs up all schemas except the system schemas.
> **Note:**
Expand Down Expand Up @@ -474,6 +489,7 @@ The prerequisites for the scheduled full backup is the same as the [prerequisite
# timeAgo: ${time}
# checksum: true
# sendCredToTikv: true
# Only needed for TiDB Operator < v1.1.7 or TiDB < v4.0.8
from:
host: ${tidb_host}
port: ${tidb_port}
Expand Down Expand Up @@ -523,6 +539,7 @@ The prerequisites for the scheduled full backup is the same as the [prerequisite
# rateLimit: 0
# timeAgo: ${time}
# checksum: true
# Only needed for TiDB Operator < v1.1.7 or TiDB < v4.0.8
from:
host: ${tidb_host}
port: ${tidb_port}
Expand Down Expand Up @@ -570,6 +587,7 @@ The prerequisites for the scheduled full backup is the same as the [prerequisite
# rateLimit: 0
# timeAgo: ${time}
# checksum: true
# Only needed for TiDB Operator < v1.1.7 or TiDB < v4.0.8
from:
host: ${tidb_host}
port: ${tidb_port}
Expand Down
23 changes: 18 additions & 5 deletions en/backup-to-gcs-using-br.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ This document provides examples in which the data of the `demo1` TiDB cluster in
kubectl create secret generic backup-demo1-tidb-secret --from-literal=password=<password> --namespace=test1
```

> **Note:**
>
> If TiDB Operator >= v1.1.7 && TiDB >= v4.0.8, `tikv_gc_life_time` will be adjusted by BR automatically, so you can omit this step.

### Required database account privileges

* The `SELECT` and `UPDATE` privileges of the `mysql.tidb` table: Before and after the backup, the `Backup` CR needs a database account with these privileges to adjust the GC time.
Expand Down Expand Up @@ -149,28 +153,32 @@ This document provides examples in which the data of the `demo1` TiDB cluster in
More descriptions of fields in the `Backup` CR:

* `.spec.metadata.namespace`: The namespace where the `Backup` CR is located.
* `.spec.tikvGCLifeTime`: The temporary `tikv_gc_lifetime` time setting during the backup. Defaults to 72h.
* `.spec.tikvGCLifeTime`: The temporary `tikv_gc_life_time` time setting during the backup. Defaults to 72h.

Before the backup begins, if the `tikv_gc_lifetime` setting in the TiDB cluster is smaller than `spec.tikvGCLifeTime` set by the user, TiDB Operator adjusts the value of `tikv_gc_lifetime` to the value of `spec.tikvGCLifeTime`. This operation makes sure that the backup data is not garbage-collected by TiKV.
Before the backup begins, if the `tikv_gc_life_time` setting in the TiDB cluster is smaller than `spec.tikvGCLifeTime` set by the user, TiDB Operator adjusts the value of `tikv_gc_life_time` to the value of `spec.tikvGCLifeTime`. This operation makes sure that the backup data is not garbage-collected by TiKV.

After the backup, no matter whether the backup is successful or not, as long as the previous `tikv_gc_lifetime` is smaller than `.spec.tikvGCLifeTime`, TiDB Operator will try to set `tikv_gc_lifetime` to the previous value.
After the backup, no matter whether the backup is successful or not, as long as the previous `tikv_gc_life_time` is smaller than `.spec.tikvGCLifeTime`, TiDB Operator will try to set `tikv_gc_life_time` to the previous value.

In extreme cases, if TiDB Operator fails to access the database, TiDB Operator cannot automatically recover the value of `tikv_gc_lifetime` and treats the backup as failed. At this time, you can view `tikv_gc_lifetime` of the current TiDB cluster using the following statement:
In extreme cases, if TiDB Operator fails to access the database, TiDB Operator cannot automatically recover the value of `tikv_gc_life_time` and treats the backup as failed. At this time, you can view `tikv_gc_life_time` of the current TiDB cluster using the following statement:

{{< copyable "sql" >}}

```sql
select VARIABLE_NAME, VARIABLE_VALUE from mysql.tidb where VARIABLE_NAME like "tikv_gc_life_time";
```
In the output of the command above, if the value of `tikv_gc_lifetime` is still larger than expected (10m by default), it means TiDB Operator failed to automatically recover the value. Therefore, you need to set `tikv_gc_lifetime` back to the previous value manually:
In the output of the command above, if the value of `tikv_gc_life_time` is still larger than expected (10m by default), it means TiDB Operator failed to automatically recover the value. Therefore, you need to set `tikv_gc_life_time` back to the previous value manually:
{{< copyable "sql" >}}
```sql
update mysql.tidb set VARIABLE_VALUE = '10m' where VARIABLE_NAME = 'tikv_gc_life_time';
```
> **Note:**
>
> If TiDB Operator >= v1.1.7 && TiDB >= v4.0.8, `tikv_gc_life_time` will be adjusted by BR automatically, so you can omit `spec.tikvGCLifeTime`.
* `.spec.cleanPolicy`: The clean policy of the backup data when the backup CR is deleted after the backup is completed.
Three clean policies are supported:
Expand Down Expand Up @@ -199,6 +207,10 @@ More descriptions of fields in the `Backup` CR:
kubectl create secret generic ${secret_name} --namespace=${namespace} --from-file=tls.crt=${cert_path} --from-file=tls.key=${key_path} --from-file=ca.crt=${ca_path}
```
> **Note:**
>
> If TiDB Operator >= v1.1.7 && TiDB >= v4.0.8, `tikv_gc_life_time` will be adjusted by BR automatically, so you can omit `spec.from`.
* `.spec.tableFilter`: BR only backs up tables that match the [table filter rules](https://docs.pingcap.com/tidb/stable/table-filter/). This field can be ignored by default. If the field is not configured, BR backs up all schemas except the system schemas.
> **Note:**
Expand Down Expand Up @@ -244,6 +256,7 @@ The prerequisites for the scheduled full backup is the same with the [prerequisi
maxReservedTime: "3h"
schedule: "*/2 * * * *"
backupTemplate:
# Only needed for TiDB Operator < v1.1.7 or TiDB < v4.0.8
from:
host: ${tidb_host}
port: ${tidb_port}
Expand Down
10 changes: 5 additions & 5 deletions en/backup-to-gcs.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,21 @@ kubectl get bk -n test1 -owide
More parameter description:

* `.spec.metadata.namespace`: the namespace where the `Backup` CR is located.
* `.spec.tikvGCLifeTime`: the temporary `tikv_gc_lifetime` time setting during the backup. Defaults to 72h.
* `.spec.tikvGCLifeTime`: the temporary `tikv_gc_life_time` time setting during the backup. Defaults to 72h.

Before the backup begins, if the `tikv_gc_lifetime` setting in the TiDB cluster is smaller than `spec.tikvGCLifeTime` set by the user, TiDB Operator adjusts the value of `tikv_gc_lifetime` to the value of `spec.tikvGCLifeTime`. This operation makes sure that the backup data is not garbage-collected by TiKV.
Before the backup begins, if the `tikv_gc_life_time` setting in the TiDB cluster is smaller than `spec.tikvGCLifeTime` set by the user, TiDB Operator adjusts the value of `tikv_gc_life_time` to the value of `spec.tikvGCLifeTime`. This operation makes sure that the backup data is not garbage-collected by TiKV.

After the backup, no matter whether the backup is successful or not, as long as the previous `tikv_gc_lifetime` is smaller than `.spec.tikvGCLifeTime`, TiDB Operator will try to set `tikv_gc_lifetime` to the previous value.
After the backup, no matter whether the backup is successful or not, as long as the previous `tikv_gc_life_time` is smaller than `.spec.tikvGCLifeTime`, TiDB Operator will try to set `tikv_gc_life_time` to the previous value.

In extreme cases, if TiDB Operator fails to access the database, TiDB Operator cannot automatically recover the value of `tikv_gc_lifetime` and treats the backup as failed. At this time, you can view `tikv_gc_lifetime` of the current TiDB cluster using the following statement:
In extreme cases, if TiDB Operator fails to access the database, TiDB Operator cannot automatically recover the value of `tikv_gc_life_time` and treats the backup as failed. At this time, you can view `tikv_gc_life_time` of the current TiDB cluster using the following statement:

{{< copyable "sql" >}}

```sql
select VARIABLE_NAME, VARIABLE_VALUE from mysql.tidb where VARIABLE_NAME like "tikv_gc_life_time";
```
In the output of the command above, if the value of `tikv_gc_lifetime` is still larger than expected (10m by default), it means TiDB Operator failed to automatically recover the value. Therefore, you need to set `tikv_gc_lifetime` back to the previous value manually:
In the output of the command above, if the value of `tikv_gc_life_time` is still larger than expected (10m by default), it means TiDB Operator failed to automatically recover the value. Therefore, you need to set `tikv_gc_life_time` back to the previous value manually:
{{< copyable "sql" >}}
Expand Down
10 changes: 5 additions & 5 deletions en/backup-to-s3.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,21 +255,21 @@ kubectl get bk -n test1 -owide
More `Backup` CR parameter description:
* `.spec.metadata.namespace`: the namespace where the `Backup` CR is located.
* `.spec.tikvGCLifeTime`: the temporary `tikv_gc_lifetime` time setting during the backup. Defaults to 72h.
* `.spec.tikvGCLifeTime`: the temporary `tikv_gc_life_time` time setting during the backup. Defaults to 72h.
Before the backup begins, if the `tikv_gc_lifetime` setting in the TiDB cluster is smaller than `spec.tikvGCLifeTime` set by the user, TiDB Operator adjusts the value of `tikv_gc_lifetime` to the value of `spec.tikvGCLifeTime`. This operation makes sure that the backup data is not garbage-collected by TiKV.
Before the backup begins, if the `tikv_gc_life_time` setting in the TiDB cluster is smaller than `spec.tikvGCLifeTime` set by the user, TiDB Operator adjusts the value of `tikv_gc_life_time` to the value of `spec.tikvGCLifeTime`. This operation makes sure that the backup data is not garbage-collected by TiKV.
After the backup, no matter whether the backup is successful or not, as long as the previous `tikv_gc_lifetime` is smaller than `.spec.tikvGCLifeTime`, TiDB Operator will try to set `tikv_gc_lifetime` to the previous value.
After the backup, no matter whether the backup is successful or not, as long as the previous `tikv_gc_life_time` is smaller than `.spec.tikvGCLifeTime`, TiDB Operator will try to set `tikv_gc_life_time` to the previous value.
In extreme cases, if TiDB Operator fails to access the database, TiDB Operator cannot automatically recover the value of `tikv_gc_lifetime` and treats the backup as failed. At this time, you can view `tikv_gc_lifetime` of the current TiDB cluster using the following statement:
In extreme cases, if TiDB Operator fails to access the database, TiDB Operator cannot automatically recover the value of `tikv_gc_life_time` and treats the backup as failed. At this time, you can view `tikv_gc_life_time` of the current TiDB cluster using the following statement:
{{< copyable "sql" >}}
```sql
select VARIABLE_NAME, VARIABLE_VALUE from mysql.tidb where VARIABLE_NAME like "tikv_gc_life_time";
```
In the output of the command above, if the value of `tikv_gc_lifetime` is still larger than expected (10m by default), it means TiDB Operator failed to automatically recover the value. Therefore, you need to set `tikv_gc_lifetime` back to the previous value manually:
In the output of the command above, if the value of `tikv_gc_life_time` is still larger than expected (10m by default), it means TiDB Operator failed to automatically recover the value. Therefore, you need to set `tikv_gc_life_time` back to the previous value manually:
{{< copyable "sql" >}}
Expand Down
11 changes: 11 additions & 0 deletions en/restore-from-aws-s3-using-br.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Refer to [Back up Data to Amazon S3 using BR](backup-to-aws-s3-using-br.md#three

Before you restore data from Amazon S3 storage, you need to grant AWS account permissions. This section describes three methods to grant AWS account permissions.

> **Note:**
>
> If TiDB Operator >= v1.1.7 && TiDB >= v4.0.8, `tikv_gc_life_time` will be adjusted by BR automatically. You can omit the step that creates the secret which stores the account and password needed to access the TiDB cluster.
### Grant permissions by importing AccessKey and SecretKey

1. Download [backup-rbac.yaml](https://github.com/pingcap/tidb-operator/blob/master/manifests/backup/backup-rbac.yaml), and execute the following command to create the role-based access control (RBAC) resources in the `test2` namespace:
Expand Down Expand Up @@ -167,6 +171,7 @@ Before you restore data from Amazon S3 storage, you need to grant AWS account pe
# timeAgo: ${time}
# checksum: true
# sendCredToTikv: true
# Only needed for TiDB Operator < v1.1.7 or TiDB < v4.0.8
to:
host: ${tidb_host}
port: ${tidb_port}
Expand Down Expand Up @@ -210,6 +215,7 @@ Before you restore data from Amazon S3 storage, you need to grant AWS account pe
# rateLimit: 0
# timeAgo: ${time}
# checksum: true
# Only needed for TiDB Operator < v1.1.7 or TiDB < v4.0.8
to:
host: ${tidb_host}
port: ${tidb_port}
Expand Down Expand Up @@ -251,6 +257,7 @@ Before you restore data from Amazon S3 storage, you need to grant AWS account pe
# rateLimit: 0
# timeAgo: ${time}
# checksum: true
# Only needed for TiDB Operator < v1.1.7 or TiDB < v4.0.8
to:
host: ${tidb_host}
port: ${tidb_port}
Expand Down Expand Up @@ -288,6 +295,10 @@ More `Restore` CR fields are described as follows:
kubectl create secret generic ${secret_name} --namespace=${namespace} --from-file=tls.crt=${cert_path} --from-file=tls.key=${key_path} --from-file=ca.crt=${ca_path}
```

> **Note:**
>
> If TiDB Operator >= v1.1.7 && TiDB >= v4.0.8, `tikv_gc_life_time` will be adjusted by BR automatically, so you can omit `spec.to`.

* `.spec.tableFilter`: BR only restores tables that match the [table filter rules](https://docs.pingcap.com/tidb/stable/table-filter/). This field can be ignored by default. If the field is not configured, BR restores all schemas except the system schemas.

> **Note:**
Expand Down
Loading

0 comments on commit 32855ae

Please sign in to comment.