Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update log backup user docs #2641

Merged
merged 67 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
12939f6
subcommands
RidRisR Oct 25, 2024
10092d5
stop
RidRisR Oct 25, 2024
1cb9ff6
crd
RidRisR Oct 25, 2024
e3d72d7
Update en/backup-to-aws-s3-using-br.md
RidRisR Nov 11, 2024
52450ed
Update en/backup-to-aws-s3-using-br.md
RidRisR Nov 11, 2024
8674d2c
fix
RidRisR Nov 11, 2024
99f9953
lint
RidRisR Nov 12, 2024
21e686b
lint
RidRisR Nov 12, 2024
1c333ce
lint
RidRisR Nov 12, 2024
8e6533e
Update zh/backup-to-aws-s3-using-br.md
RidRisR Nov 25, 2024
95d1c68
fix comment
RidRisR Nov 28, 2024
fd68f5b
modify more examples
RidRisR Nov 28, 2024
a7fc814
lint
RidRisR Nov 28, 2024
9252218
add version
RidRisR Nov 28, 2024
dc23a0d
Update zh/backup-restore-overview.md
RidRisR Nov 28, 2024
ef1a001
Update en/backup-to-aws-s3-using-br.md
RidRisR Nov 28, 2024
33b1b74
Update en/backup-to-aws-s3-using-br.md
RidRisR Nov 28, 2024
1bf5060
fix comment
RidRisR Nov 28, 2024
5132b8b
use -
RidRisR Nov 28, 2024
2770c85
lint
RidRisR Nov 28, 2024
461ed2a
fix
RidRisR Nov 28, 2024
be007a3
fix
RidRisR Nov 28, 2024
6882037
replace • with -
RidRisR Nov 29, 2024
ce5ac2d
lint
RidRisR Nov 29, 2024
7dda757
Discard changes to .markdownlint.yaml
Oreoxmt Dec 25, 2024
f869a85
Update zh/backup-to-azblob-using-br.md
RidRisR Dec 26, 2024
1534f5e
Update zh/backup-to-azblob-using-br.md
RidRisR Dec 26, 2024
ee452f7
Update zh/backup-to-azblob-using-br.md
RidRisR Dec 26, 2024
168ed6b
Update zh/backup-to-azblob-using-br.md
RidRisR Dec 26, 2024
015a4d2
Update zh/backup-to-azblob-using-br.md
RidRisR Dec 26, 2024
1296659
Update zh/backup-to-azblob-using-br.md
RidRisR Dec 26, 2024
760b637
Update zh/backup-to-azblob-using-br.md
RidRisR Dec 26, 2024
f13a5cf
Update zh/backup-to-azblob-using-br.md
RidRisR Dec 26, 2024
dbb04fd
Update zh/backup-to-azblob-using-br.md
RidRisR Dec 26, 2024
05e8505
Update zh/backup-to-azblob-using-br.md
RidRisR Dec 26, 2024
f29b5fa
Update zh/backup-to-azblob-using-br.md
RidRisR Dec 26, 2024
734177c
Update zh/backup-to-azblob-using-br.md
RidRisR Dec 26, 2024
55b2671
Update zh/backup-to-azblob-using-br.md
RidRisR Dec 26, 2024
041af46
Update zh/backup-to-gcs-using-br.md
RidRisR Dec 26, 2024
f80c664
Update zh/backup-to-gcs-using-br.md
RidRisR Dec 26, 2024
8f56e79
Update zh/backup-restore-cr.md
RidRisR Dec 26, 2024
0268bf1
Update zh/backup-restore-overview.md
RidRisR Dec 26, 2024
ec8d4f0
Update zh/backup-to-aws-s3-using-br.md
RidRisR Dec 26, 2024
445bb38
Update zh/backup-to-gcs-using-br.md
RidRisR Dec 27, 2024
672f640
Update zh/backup-to-aws-s3-using-br.md
RidRisR Dec 27, 2024
a9284cc
Update zh/backup-to-aws-s3-using-br.md
RidRisR Dec 27, 2024
eddbf6c
Update zh/backup-to-aws-s3-using-br.md
RidRisR Dec 27, 2024
836edde
Update zh/backup-to-aws-s3-using-br.md
RidRisR Dec 27, 2024
1d62216
Update zh/backup-to-aws-s3-using-br.md
RidRisR Dec 27, 2024
77497fd
Update zh/backup-to-aws-s3-using-br.md
RidRisR Dec 27, 2024
279a215
Update zh/backup-to-aws-s3-using-br.md
RidRisR Dec 27, 2024
08d675a
Update zh/backup-to-aws-s3-using-br.md
RidRisR Dec 27, 2024
ab19385
Update zh/backup-to-aws-s3-using-br.md
RidRisR Dec 27, 2024
41807a2
Update zh/backup-to-aws-s3-using-br.md
RidRisR Dec 27, 2024
d676ce8
Update zh/backup-to-gcs-using-br.md
RidRisR Dec 27, 2024
a512ca0
Update zh/backup-to-gcs-using-br.md
RidRisR Dec 27, 2024
b7c88bc
Update zh/backup-to-gcs-using-br.md
RidRisR Dec 27, 2024
c0f963e
Update zh/backup-to-gcs-using-br.md
RidRisR Dec 27, 2024
4e47ffb
Update zh/backup-to-gcs-using-br.md
RidRisR Dec 27, 2024
95c2695
Update zh/backup-to-gcs-using-br.md
RidRisR Dec 27, 2024
6df8bb8
Update zh/backup-to-gcs-using-br.md
RidRisR Dec 27, 2024
9d70fc0
Update zh/backup-to-gcs-using-br.md
RidRisR Dec 27, 2024
c201b83
fix wrong storage type
RidRisR Jan 16, 2025
04dcaac
align with Chinese and revise wording
Oreoxmt Jan 17, 2025
40047ba
Merge pull request #1 from Oreoxmt/review-operator-2641
RidRisR Jan 20, 2025
b880ac5
add chinese part
RidRisR Jan 20, 2025
1e98023
Apply suggestions from code review
Oreoxmt Jan 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions en/backup-restore-cr.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ This section introduces the fields in the `Backup` CR.
* `volume-snapshot`: back up data by volume snapshots.
* `log`: back up log data in real time in the KV layer.

* `.spec.logSubcommand`: the subcommand for controlling the log backup status in the Backup CR. This field provides three options for managing a log backup task:
RidRisR marked this conversation as resolved.
Show resolved Hide resolved
* `log-start`: initiates a new log backup task or resumes a paused task. Use this command to start the log backup process or resume a task from a paused state.
* `log-pause`: temporarily pauses the currently running log backup task. After pausing, you can use the `log-start` command to resume the task.
* `log-stop`: permanently stops the log backup task. After executing this command, the Backup CR enters a stopped state and cannot be restarted.

For versions before v1.5.5, use the `logStop` field with boolean values (`true`/`false`) to control log backup operations. While `logStop` is still supported in v1.5.5 and v1.6.1, it is recommended to use `logSubcommand` instead.

* `.spec.restoreMode`: the restore mode. The default value is `snapshot`, which means restoring data from snapshots in the KV layer. This field is valid only for restore and has three value options currently:
* `snapshot`: restore data from snapshots in the KV layer.
* `volume-snapshot`: restore data from volume snapshots.
Expand Down
2 changes: 2 additions & 0 deletions en/backup-restore-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ kubectl delete backupschedule ${name} -n ${namespace}

If you use TiDB Operator v1.1.2 or an earlier version, or if you use TiDB Operator v1.1.3 or a later version and set the value of `spec.cleanPolicy` to `Delete`, TiDB Operator cleans the backup data when it deletes the CR.

If you use v1.5.5, v1.6.1, or a later version, TiDB Operator automatically attempts to stop running log backup tasks when you delete the Custom Resource (CR). This automatic stop feature only applies to log backup tasks that are running normally and does not handle tasks in an error or failed state.

If you back up cluster data using AWS EBS volume snapshots and set the value of `spec.cleanPolicy` to `Delete`, TiDB Operator deletes the CR, and cleans up the backup file and the volume snapshots on AWS.

In such cases, if you need to delete the namespace, it is recommended that you first delete all the `Backup`/`BackupSchedule` CRs and then delete the namespace.
Expand Down
128 changes: 122 additions & 6 deletions en/backup-to-aws-s3-using-br.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,26 @@ demo1-full-backup-s3 full snapshot Complete s3://my-bucket/my-full-backu

You can use a `Backup` CR to describe the start and stop of a log backup task and manage the log backup data. Log backup grants permissions to remote storages in the same way as snapshot backup. In this section, the example shows log backup operations by taking a `Backup` CR named `demo1-log-backup-s3` as an example. Note that these operations assume that permissions to remote storages are granted using accessKey and secretKey. See the following detailed steps.

#### Description of the `logSubcommand` field

In the Backup Custom Resource (CR), you can use the `logSubcommand` field to control the state of a log backup task. The `logSubcommand` field supports the following commands:

- `log-start`: initiates a new log backup task or resumes a paused task. Use this command to start the log backup process or resume a task from a paused state.

- `log-pause`: temporarily pauses the currently running log backup task. After pausing, you can use the `log-start` command to resume the task.

- `log-stop`: permanently stops the log backup task. After executing this command, the Backup CR enters a stopped state and cannot be restarted.

These commands provide fine-grained control over the lifecycle of log backup tasks, enabling you to start, pause, resume, and stop tasks effectively to manage log data retention in Kubernetes environments.

<Tip>

In TiDB Operator v1.5.4, v1.6.0, and earlier versions, you can use the `logStop: true/false` field to stop or start log backup tasks. This field is retained for backward compatibility.

However, do not use `logStop` and `logSubcommand` fields in the same Backup CR, as this is not supported. For TiDB Operator v1.5.5, v1.6.1, and later versions, it is recommended to use the `logSubcommand` field to ensure clear and consistent configuration.

</Tip>

#### Start log backup

1. In the `backup-test` namespace, create a `Backup` CR named `demo1-log-backup-s3`.
Expand All @@ -247,6 +267,7 @@ You can use a `Backup` CR to describe the start and stop of a log backup task an
namespace: backup-test
spec:
backupMode: log
logSubcommand: log-start
br:
cluster: demo1
clusterNamespace: test1
Expand Down Expand Up @@ -308,15 +329,105 @@ Conditions:
Log Checkpoint Ts: 436569119308644661
```

#### Pause log backup

You can pause a log backup task by setting the `logSubcommand` field of the Backup Custom Resource (CR) to `log-pause`. The following example shows how to pause the `demo1-log-backup-s3` CR created in [Start log backup](#start-log-backup).

```shell
kubectl edit backup demo1-log-backup-s3 -n backup-test
```

To pause the log backup task, change the value of `logSubcommand` from `log-start` to `log-pause`, then save and exit the editor. The modified content is as follows:

```yaml
---
apiVersion: pingcap.com/v1alpha1
kind: Backup
metadata:
name: demo1-log-backup-s3
namespace: backup-test
spec:
backupMode: log
logSubcommand: log-pause
br:
cluster: demo1
clusterNamespace: test1
sendCredToTikv: true
s3:
provider: aws
secretName: s3-secret
region: us-west-1
bucket: my-bucket
prefix: my-log-backup-folder
```

You can verify that the `STATUS` of the `demo1-log-backup-s3` Backup CR changes from `Running` to `Pause`:

```shell
kubectl get backup -n backup-test
```

```
NAME MODE STATUS ....
demo1-log-backup-s3 log Pause ....
```

#### Resume log backup

If a log backup task is paused, you can resume it by setting the `logSubcommand` field to `log-start`. The following example shows how to resume the `demo1-log-backup-s3` CR that was paused in [Pause Log Backup](#pause-log-backup).

> **Note:**
>
> This operation applies only to tasks in the `Pause` state. You cannot resume tasks in the `Fail` or `Stopped` state.

```shell
kubectl edit backup demo1-log-backup-s3 -n backup-test
```

To resume the log backup task, change the value of `logSubcommand` from `log-pause` to `log-start`, then save and exit the editor. The modified content is as follows:

```yaml
---
apiVersion: pingcap.com/v1alpha1
kind: Backup
metadata:
name: demo1-log-backup-s3
namespace: backup-test
spec:
backupMode: log
logSubcommand: log-start
br:
cluster: demo1
clusterNamespace: test1
sendCredToTikv: true
s3:
provider: aws
secretName: s3-secret
region: us-west-1
bucket: my-bucket
prefix: my-log-backup-folder
```

You can verify that the `STATUS` of the `demo1-log-backup-s3` Backup CR changes from `Pause` to `Running`:

```shell
kubectl get backup -n backup-test
```

```
NAME MODE STATUS ....
demo1-log-backup-s3 log Running ....
```

#### Stop log backup

Because you already created a `Backup` CR named `demo1-log-backup-s3` when you started log backup, you can stop the log backup by modifying the same `Backup` CR. The priority of all operations is: stop log backup > delete log backup data > start log backup.
You can stop a log backup task by setting the `logSubcommand` field of the Backup Custom Resource (CR) to `log-stop`. The following example shows how to stop the `demo1-log-backup-s3` CR created in [Start log backup](#start-log-backup).

```shell
kubectl edit backup demo1-log-backup-s3 -n backup-test
```

In the last line of the CR, append `spec.logStop: true`. Then save and quit the editor. The modified content is as follows:
Change the value of `logSubcommand` to `log-stop`, then save and exit the editor. The modified content is as follows:

```yaml
---
Expand All @@ -327,6 +438,7 @@ metadata:
namespace: backup-test
spec:
backupMode: log
logSubcommand: log-stop
br:
cluster: demo1
clusterNamespace: test1
Expand All @@ -337,10 +449,9 @@ spec:
region: us-west-1
bucket: my-bucket
prefix: my-log-backup-folder
logStop: true
```

You can see the `STATUS` of the `Backup` CR named `demo1-log-backup-s3` change from `Running` to `Stopped`:
You can verify that the `STATUS` of the `Backup` CR named `demo1-log-backup-s3` changes from `Running` to `Stopped`:

```shell
kubectl get backup -n backup-test
Expand All @@ -352,12 +463,16 @@ demo1-log-backup-s3 log Stopped ....
```

<Tip>
You can also stop log backup by taking the same steps as in [Start log backup](#start-log-backup). The existing `Backup` CR will be updated.

`Stopped` is the terminal state for log backup. In this state, you cannot change the backup state again, but you can still clean up the log backup data.

In TiDB Operator v1.5.4, v1.6.0, and earlier versions, you can use the `logStop: true/false` field to stop or start log backup tasks. This field is retained for backward compatibility.

</Tip>

#### Clean log backup data

1. Because you already created a `Backup` CR named `demo1-log-backup-s3` when you started log backup, you can clean the log data backup by modifying the same `Backup` CR. The priority of all operations is: stop log backup > delete log backup data > start log backup. The following example shows how to clean log backup data generated before 2022-10-10T15:21:00+08:00.
1. Because you already created a `Backup` CR named `demo1-log-backup-s3` when you started log backup, you can clean the log data backup by modifying the same `Backup` CR. The following example shows how to clean log backup data generated before 2022-10-10T15:21:00+08:00.

```shell
kubectl edit backup demo1-log-backup-s3 -n backup-test
Expand All @@ -374,6 +489,7 @@ You can also stop log backup by taking the same steps as in [Start log backup](#
namespace: backup-test
spec:
backupMode: log
logSubcommand: log-start/log-pause/log-stop
br:
cluster: demo1
clusterNamespace: test1
Expand Down
Loading
Loading