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
# ^ ^ ^
# | | +- ……仅恢复 `mysql`.`usertable`。
# | +- ……但是过滤掉 `mysql` 中的其它表……
# +- 恢复所有表……
Copy link
Contributor

Choose a reason for hiding this comment

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

能否将注释拿出来单独描述?这里使用了三个 -f,如果不能在一条命令中同时指定,是否需要写三个命令来分开说明呢?

Copy link
Contributor

Choose a reason for hiding this comment

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

@3pointer PTAL, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里的三个 -f 应该是要在一条命令中同时指定的,稍后我处理一下这个……

```

> **警告:**
>
> 即便系统表(例如,`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