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

*: add br tool doc and refine mydumper/loader doc #1680

Merged
merged 24 commits into from
Dec 6, 2019

Conversation

TomShawn
Copy link
Contributor

@TomShawn TomShawn commented Nov 29, 2019

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

@TomShawn TomShawn added dev translation/from-docs-cn This PR is translated from a PR in pingcap/docs-cn. size/large Changes of a large size. labels Nov 29, 2019
@TomShawn TomShawn marked this pull request as ready for review November 29, 2019 07:54
@TomShawn TomShawn changed the title tools: add br tool doc and refine mydumper/loader doc [WIP]tools: add br tool doc and refine mydumper/loader doc Nov 29, 2019
@TomShawn TomShawn changed the title [WIP]tools: add br tool doc and refine mydumper/loader doc [WIP] tools: add br tool doc and refine mydumper/loader doc Nov 29, 2019
@TomShawn TomShawn changed the title [WIP] tools: add br tool doc and refine mydumper/loader doc maintain: add br tool doc and refine mydumper/loader doc Dec 2, 2019
@lilin90 lilin90 added the priority/P1 The issue has P1 priority. label Dec 3, 2019
dev/how-to/maintain/backup-and-restore/br.md Outdated Show resolved Hide resolved
dev/how-to/maintain/backup-and-restore/br.md Outdated Show resolved Hide resolved
dev/how-to/maintain/backup-and-restore/br.md Outdated Show resolved Hide resolved
dev/how-to/maintain/backup-and-restore/br.md Outdated Show resolved Hide resolved
dev/how-to/maintain/backup-and-restore/br.md Outdated Show resolved Hide resolved
dev/how-to/maintain/backup-and-restore/br.md Outdated Show resolved Hide resolved
dev/how-to/maintain/backup-and-restore/br.md Outdated Show resolved Hide resolved
dev/how-to/maintain/backup-and-restore/br.md Outdated Show resolved Hide resolved
dev/how-to/maintain/backup-and-restore/br.md Outdated Show resolved Hide resolved
dev/how-to/maintain/backup-and-restore/br.md Outdated Show resolved Hide resolved
* `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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* `--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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* `--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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

@lilin90 lilin90 changed the title maintain: add br tool doc and refine mydumper/loader doc *: add br tool doc and refine mydumper/loader doc Dec 6, 2019

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Member

@lilin90 lilin90 left a 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!

@lilin90 lilin90 merged commit f36b733 into pingcap:master Dec 6, 2019
@TomShawn TomShawn deleted the add-br-tool branch December 6, 2019 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/P1 The issue has P1 priority. size/large Changes of a large size. translation/from-docs-cn This PR is translated from a PR in pingcap/docs-cn.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants