-
Notifications
You must be signed in to change notification settings - Fork 678
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
*: add br tool doc and refine mydumper/loader doc #1680
Conversation
* `br restore`: used to restore the data of the TiDB cluster. | ||
* `br version`: used to check the version of BR. | ||
|
||
Each of the above three sub-commands might include the following three sub-commands to specify the scope of an operation: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each of the above three sub-commands might include the following three sub-commands to specify the scope of an operation: | |
Each of the above three sub-commands might still include the following three sub-commands to specify the scope of an operation: |
Explanations for some options in the above command are as follows: | ||
|
||
* `--ratelimit`: specifies the maximum speed at which a backup operation is performed (MiB/s) on each TiKV node. | ||
* `--concurrency`: sets an upper limit on the number of concurrent executions on each TiKV node. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `--concurrency`: sets an upper limit on the number of concurrent executions on each TiKV node. | |
* `--concurrency`: sets an upper limit on the number of concurrent operations on each TiKV node. |
|
||
* `--ratelimit`: specifies the maximum speed at which a backup operation is performed (MiB/s) on each TiKV node. | ||
* `--concurrency`: sets an upper limit on the number of concurrent executions on each TiKV node. | ||
* `--log-file`: specifies that the BR log is written to the `backupfull.log` file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `--log-file`: specifies that the BR log is written to the `backupfull.log` file. | |
* `--log-file`: specifies writing the BR log to the `backupfull.log` file. |
* `--concurrency`: sets an upper limit on the number of concurrent executions on each TiKV node. | ||
* `--log-file`: specifies that the BR log is written to the `backupfull.log` file. | ||
|
||
A progress bar is displayed in the terminal during the backup. When the progress bar advances to 100%, the backup is complete. Then the BR also checks the backup data to ensure data security. The progress bar is displayed as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A progress bar is displayed in the terminal during the backup. When the progress bar advances to 100%, the backup is complete. Then the BR also checks the backup data to ensure data security. The progress bar is displayed as follows: | |
A progress bar is displayed in the terminal during the backup. When the progress bar advances to 100%, the backup is complete. Then the BR also checks the backup data to ensure data safety. The progress bar is displayed as follows: |
Full Backup <---------/................................................> 17.12%. | ||
``` | ||
|
||
### Back up single table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Back up single table | |
### Back up data of a single table |
|
||
This section shows how to back up and restore the data of an existing cluster. You can estimate the performance of backup and restoration based on machine performance, configuration and data size. | ||
|
||
### Data size and machine configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Data size and machine configuration | |
### Data volume and machine configuration |
|
||
### Data size and machine configuration | ||
|
||
Suppose that the backup and restoration operations are performed on 10 tables in the TiKV cluster, each table with 5 million rows of data. The total data size is 35 GB. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suppose that the backup and restoration operations are performed on 10 tables in the TiKV cluster, each table with 5 million rows of data. The total data size is 35 GB. | |
Suppose that the backup and restoration operations are performed on 10 tables in the TiKV cluster, each table with 5 million rows of data. The total data volume is 35 GB. |
|
||
### Backup | ||
|
||
Before the backup operation, make sure the following things are done: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before the backup operation, make sure the following things are done: | |
Before the backup operation, check the following two items: |
Before the backup operation, make sure the following things are done: | ||
|
||
- `tikv_gc_life_time` is set to a larger value so that the backup operation will not be interrupted by data loss. | ||
- No DDL statement is executed on TiDB. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- No DDL statement is executed on TiDB. | |
- No DDL statement is being executed on the TiDB cluster. |
|
||
Before the backup operation, make sure the following things are done: | ||
|
||
- `tikv_gc_life_time` is set to a larger value so that the backup operation will not be interrupted by data loss. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `tikv_gc_life_time` is set to a larger value so that the backup operation will not be interrupted by data loss. | |
- You have set `tikv_gc_life_time` to a larger value so that the backup operation will not be interrupted because of data loss. |
[INFO] [client.go:435] ["Restore Checksum"] [take=6.385818026s] | ||
``` | ||
|
||
## Working principles |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Working principles | |
## Implementation principles |
|
||
# Use BR to Backup and Restore Cluster Data | ||
|
||
Backup & Restore (BR) is a command-line tool for distributed backup and restoration of the TiDB cluster data. Compared with [`mydumper`/`loader`](/dev/how-to/maintain/backup-and-restore/mydumper-loader.md), BR is more suitable for scenarios of huge data volume. This document describes the BR command line, detailed use examples, best practices, restrictions, and introduces the working principles of BR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backup & Restore (BR) is a command-line tool for distributed backup and restoration of the TiDB cluster data. Compared with [`mydumper`/`loader`](/dev/how-to/maintain/backup-and-restore/mydumper-loader.md), BR is more suitable for scenarios of huge data volume. This document describes the BR command line, detailed use examples, best practices, restrictions, and introduces the working principles of BR. | |
Backup & Restore (BR) is a command-line tool for distributed backup and restoration of the TiDB cluster data. Compared with [`mydumper`/`loader`](/dev/how-to/maintain/backup-and-restore/mydumper-loader.md), BR is more suitable for scenarios of huge data volume. This document describes the BR command line, detailed use examples, best practices, restrictions, and introduces the implementation principles of BR. |
|
||
## Working principles | ||
|
||
BR sends the backup and restoration commands to each TiKV node. After receiving these commands, TiKV performs the corresponding backup and restoration operations. Each TiKV node has a path in which the backup files generated in the backup operation are stored and from which the stored backup files are read in the restoration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BR sends the backup and restoration commands to each TiKV node. After receiving these commands, TiKV performs the corresponding backup and restoration operations. Each TiKV node has a path in which the backup files generated in the backup operation are stored and from which the stored backup files are read in the restoration. | |
BR sends the backup and restoration commands to each TiKV node. After receiving these commands, TiKV performs the corresponding backup and restoration operations. Each TiKV node has a path in which the backup files generated in the backup operation are stored and from which the stored backup files are read during restoration. |
|
||
According to these information, BR starts a TiDB instance internally to obtain the database or table information corresponding to the TS, and filters out the system databases (`information_schema`, `performance_schema`, `mysql`) at the same time. | ||
|
||
According to the backup sub-command, two types of backup logic are available: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the backup sub-command, two types of backup logic are available: | |
According to the backup sub-command, BR adopts the following two types of backup logic: |
|
||
According to the backup sub-command, two types of backup logic are available: | ||
|
||
- Full backup: BR traverses all the tables and constructs the KV range to be backed up according to every table. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Full backup: BR traverses all the tables and constructs the KV range to be backed up according to every table. | |
- Full backup: BR traverses all the tables and constructs the KV range to be backed up according to each table. |
|
||
After TiKV receives the request to load the SST file, TiKV uses the Raft mechanism to ensure the strong consistency of the SST data. After the downloaded SST file is loaded successfully, the file is deleted asynchronously. | ||
|
||
After the restoration operation, BR performs a checksum calculation on the restored data to compare the stored data with the backed up data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the restoration operation, BR performs a checksum calculation on the restored data to compare the stored data with the backed up data. | |
After the restoration operation is completed, BR performs a checksum calculation on the restored data to compare the stored data with the backed up data. |
@@ -1,14 +1,15 @@ | |||
--- | |||
title: Backup and Restore | |||
summary: Learn how to back up and restore the data of TiDB. | |||
title: Use `mydumper`/`loader` to Backup and Restore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
title: Use `mydumper`/`loader` to Backup and Restore | |
title: Use `mydumper` and `loader` to Back up and Restore Data |
title: Backup and Restore | ||
summary: Learn how to back up and restore the data of TiDB. | ||
title: Use `mydumper`/`loader` to Backup and Restore | ||
summary: Learn how to backup and restore the data of TiDB using `mydumper`/`loader`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
summary: Learn how to backup and restore the data of TiDB using `mydumper`/`loader`. | |
summary: Learn how to back up and restore the data of TiDB using `mydumper` and `loader`. |
--- | ||
|
||
# Backup and Restore | ||
# Use `mydumper`/`loader` to Backup and Restore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Use `mydumper`/`loader` to Backup and Restore | |
# Use `mydumper` and `loader` to Back up and Restore Data |
|
||
This document describes how to back up and restore the data of TiDB. Currently, this document only covers full backup and restoration. | ||
This document describes how to back up and restore the data of TiDB using `mydumper`/`loader`. Currently, this document only covers full backup and restoration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This document describes how to back up and restore the data of TiDB using `mydumper`/`loader`. Currently, this document only covers full backup and restoration. | |
This document describes how to back up and restore the data of TiDB using `mydumper` and `loader`. Currently, this document only covers full backup and restoration. |
|
||
After TiKV receives the request to load the SST file, TiKV uses the Raft mechanism to ensure the strong consistency of the SST data. After the downloaded SST file is loaded successfully, the file is deleted asynchronously. | ||
|
||
After the restoration operation is complete, BR performs a checksum calculation on the restored data to compare the stored data with the backed up data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the restoration operation is complete, BR performs a checksum calculation on the restored data to compare the stored data with the backed up data. | |
After the restoration operation is completed, BR performs a checksum calculation on the restored data to compare the stored data with the backed up data. |
|
||
After TiKV receives the request to load the SST file, TiKV uses the Raft mechanism to ensure the strong consistency of the SST data. After the downloaded SST file is loaded successfully, the file is deleted asynchronously. | ||
|
||
After the restoration operation is complete, BR performs a checksum calculation on the restored data to compare the stored data with the backed up data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the restoration operation is complete, BR performs a checksum calculation on the restored data to compare the stored data with the backed up data. | |
After the restoration operation is completed, BR performs a checksum calculation on the restored data to compare the stored data with the backed up data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@overvenus @3pointer PTAL~ Thanks!
What is changed, added or deleted?
Add the BR tool document and refine
mydumper
/loader
document.What is the related PR or file link(s)?
pingcap/docs-cn#2020
pingcap/docs-cn#2088
pingcap/docs-cn#2084
pingcap/docs-cn#2089
Which version does your change affect?
dev, v3.1