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

br: add restore to systables #6194

Merged
merged 13 commits into from
Jul 8, 2021
25 changes: 25 additions & 0 deletions br/use-br-command-line-tool.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,31 @@ br restore full \

增量恢复的方法和使用 BR 进行全量恢复的方法并无差别。需要注意,恢复增量数据的时候,需要保证备份时指定的 `last backup ts` 之前备份的数据已经全部恢复到目标集群。

### 恢复创建在 `mysql` 数据库下的表
YuJuncen marked this conversation as resolved.
Show resolved Hide resolved

在 [#1048](https://github.com/pingcap/br/pull/1048) 之后,BR 可以并且默认会备份 `mysql` 数据库下的表。
YuJuncen marked this conversation as resolved.
Show resolved Hide resolved

在恢复时,`mysql` 下的表默认会被 [table filter](/table-filter.md#表库过滤语法) 规则过滤掉,要恢复在 `mysql` 下的用户表的时候,可以通过 `-f` 来指定目标,例如,以下命令会恢复 `mysql.usertable`。
YuJuncen marked this conversation as resolved.
Show resolved Hide resolved

{{< copyable "shell-regular" >}}

```shell
br restore full -f '*.*' -f '!mysql.*' -f 'mysql.usertable' -s $external_storage_url
# ^ ^ ^
# | | +- select `mysql`.`usertable`
# | +- filter out other tables in `mysql`
# +- select all tables
YuJuncen marked this conversation as resolved.
Show resolved Hide resolved
```

> **警告:**
>
> 即便系统表(例如,`mysql.tidb` 等)也可以通过这个功能备份和恢复,但是部分系统表在恢复之后可能会出现意外状况,已知的异常如下:
YuJuncen marked this conversation as resolved.
Show resolved Hide resolved
>
> - 统计信息表(`mysql.stat_*`)无法被恢复。
> - 用户信息表(`mysql.user`)在恢复之后不会生效,直到用户手动执行 `FLUSH PRIVILEGES`。
>
> 对更多系统表恢复的兼容性测试也尚在进行中,为了防止意外,请尽量避免在生产环境中恢复系统表。
YuJuncen marked this conversation as resolved.
Show resolved Hide resolved

### Raw KV 恢复(实验性功能)

> **警告:**
Expand Down