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 br 0211 #1461

Merged
merged 6 commits into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions docs-2.0/7.data-security/2.backup-restore/2.compile-br.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## 操作步骤

1. 克隆`nebula-storage`库至机器。
1. 克隆`nebula-br`库至机器。

```bash
git clone https://github.com/vesoft-inc/nebula-br.git
Expand All @@ -31,8 +31,8 @@

```bash
[nebula-br]$ bin/br version
Nebula Backup And Restore Ultility Tool,V-0.1.0
GitSha: 8e994dc
Nebula Backup And Restore Utility Tool,V-0.1.0
GitSha: 079e7c7
GitRef: master
please run "help" subcommand for more infomation.
```
42 changes: 21 additions & 21 deletions docs-2.0/7.data-security/2.backup-restore/3.br-backup-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@ BR 编译成功后,可以备份整个图空间的数据,本文介绍如何

- 确认 Nebula Graph 服务正在运行中。

- BR 可以免密登录服务器,即在 BR 机器上的账号可以通过 SSH 免密登录到 Meta 服务器和 Storage 服务器。详情请参见 [SSH tunnels with keys](http://alexander.holbreich.org/ssh-tunnel-without-password/)。

- 如果使用 Alibaba Cloud OSS 或 Amazon S3 保存备份文件,请确保 Meta 服务器、Storage 服务器和 BR 机器都已安装相应的客户端。详情请参见 [Alibaba Cloud ossutil 文档](https://www.alibabacloud.com/help/zh/doc-detail/120075.htm#concept-303829) 和 [Amazon S3 CLI 文档](https://docs.amazonaws.cn/cli/latest/userguide/cli-services-s3.html)。

!!! Note

请创建软链接方便使用 ossutil 命令。命令为`ln -s /<ossutil_tool_installation_path>/<ossutil64 or ossutil> /usr/local/bin/ossutil`,根据实际路径和系统替换内容。
- 已下载 [nebula-agent](https://github.com/vesoft-inc/nebula-agent) 并在集群中的每个主机上运行代理服务。

- 如果在本地保存备份文件,需要在 Meta 服务器、Storage 服务器和 BR 机器上创建绝对路径相同的目录,并记录绝对路径,同时需要保证账号对该目录有写权限。

Expand All @@ -28,30 +22,36 @@ BR 编译成功后,可以备份整个图空间的数据,本文介绍如何

!!! Note

确保本地存储备份文件的路径存在
确保备份文件的路径存在

```bash
$ ./bin/br backup full --meta <ip_address> --storage <storage_path> --user <user_name> --verbose
$ ./bin/br backup full --meta <ip_address> --storage <storage_path>
```

例如运行以下命令对 meta 服务的地址为`192.168.*.*:9559`,用户名为`test`的整个集群进行全量备份操作,并将备份文件保存到本地的 `/home/test/backup`
例如运行以下命令对 meta 服务的地址为`127.0.0.1:9559`的整个集群进行全量备份操作,并将备份文件保存到本地的 `/home/nebula/backup/`路径下

```bash
$ ./bin/br backup full --meta "192.168.*.*:9559" --storage "local:///home/test/backup" --user "test" --verbose
```
$ ./bin/br backup full --meta "127.0.0.1:9559" --storage "local:///home/nebula/backup/"
```

运行以下命令对 meta 服务的地址为`127.0.0.1:9559`的整个集群进行全量备份操作,并将备份文件保存到兼容 s3 协议的对象存储服务 `br-test` 桶下的`backup`中。
```bash
br backup full --meta "127.0.0.1:9559" --s3.endpoint "http://127.0.0.1:9000" --storage="s3://br-test/backup/" --s3.access_key=minioadmin --s3.secret_key=minioadmin --s3.region=default
```

以下列出命令的相关参数。

| 参数 | 是否必需 | 默认值 | 说明 | 数据类型 |
| 参数 | 数据类型 | 是否必需 | 默认值 | 说明 |
| --- | --- | --- | --- | --- |
| --concurrent | 否 | 5 | 针对阿里云 OSS 最大并发数。 | int |
| --connection | 否 | 5 | 最大 ssh 连接数。 | int |
| --extra_args | 否 | 无 | 备份存储工具(OSS/HDFS/S3)用于备份的参数。 | string |
| --log | 否 | "br.log" | 日志路径。 | string |
| --meta | 是| 无 | meta 服务的地址和端口号。 | string |
| --stroage | 是 | 无 | BR 备份数据存储位置,格式为:\<Schema\>://\<PATH\> <br>Schema:可选值为 `local` 和 `hdfs`。 <br>PATH:存储位置的路径。 | string |
| --user | 是 | 无 | 登录到 meta/storage 服务所在主机的用户名。 | string |
| --verbose | 否 | 无 | 显示的详细信息。 | - |
| -h,-help | - | 否 | 无 | 查看帮助。 |
| --log | string | 否 | "br.log" | 日志路径。 |
| --meta | string | 是| 无 | meta 服务的地址和端口号。 |
| --spaces | stringArray | 否 | 无 | (实验性功能)指定要备份的图空间名字,未指定将备份所有图空间。 |
| --storage | string | 是 | 无 | BR 备份数据存储位置,格式为:\<Schema\>://\<PATH\> <br>Schema:可选值为 `local` 和 `s3`。选择 s3 时,需要填写`s3.access_key`、`s3.endpoint`、`s3.region`和 `s3.secret_key`。<br>PATH:存储位置的路径。|
| --s3.access_key | string | 否 | 无 | 用于标识用户。 |
| --s3.endpoint | string | 否 | 无 | S3 对外服务的访问域名的 URL,指定 http 或 https。 |
| --s3.region | string | 否 | 无 | 数据中心所在物理位置。 |
| --s3.secret_key| string | 否 | 无 | 用户用于加密签名字符串和用来验证签名字符串的密钥,必须保密。 |

## 下一步

Expand Down
141 changes: 89 additions & 52 deletions docs-2.0/7.data-security/2.backup-restore/4.br-restore-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,66 +14,103 @@

- BR 编译完成。如何编译 BR,请参见[编译 BR](2.compile-br.md)。

- 确认没有应用程序连接到待恢复数据的 Nebula Graph 集群。

- 确认集群的拓扑结构一致,即原集群和目标集群的主机数量一致。

- BR 可以免密登录服务器,即在 BR 机器上的账号可以通过 SSH 免密登录到 Meta 服务器和 Storage 服务器。详情请参见 [SSH tunnels with keys](http://alexander.holbreich.org/ssh-tunnel-without-password/)。

!!! caution

该账号必须有 Nebula Graph 安装目录的写权限,meta/storage 服务的数据目录(--data_path)的写权限。

- 执行恢复操作时需使用 `root` 用户。

- 如果使用 Alibaba Cloud OSS 或 Amazon S3 保存备份文件,请确保 Meta 服务器、Storage 服务器和 BR 机器都已安装相应的客户端。详情请参见 [Alibaba Cloud ossutil 文档](https://www.alibabacloud.com/help/zh/doc-detail/120075.htm#concept-303829) 和 [Amazon S3 CLI 文档](https://docs.amazonaws.cn/cli/latest/userguide/cli-services-s3.html)。
- 已下载 [nebula-agent](https://github.com/vesoft-inc/nebula-agent) 并在集群中的**每个**主机上运行代理服务。

!!! caution
- 确认没有应用程序连接到待恢复数据的 Nebula Graph 集群。

请创建软链接方便使用 ossutil 命令。命令为`ln -s /<ossutil_tool_installation_path>/<ossutil64 or ossutil> /usr/local/bin/ossutil`,根据实际路径和系统替换内容
- 确认集群的拓扑结构一致,即原集群和目标集群的主机数量一致,且每个主机数据文件夹数量分布一致

## 操作步骤

1. 用户可以使用以下命令列出现有备份信息:

```bash
$ ./bin/br show --storage <ip_address>
```
例如,可以使用以下命令列出在本地 `/home/test/backup` 路径中的备份的信息。
```bash
$ ./bin/br show --storage "local:///home/test/backup"
+----------------------------+---------------------+------------------+-------------+---------------+
| NAME | CREATE TIME | SPACES | FULL BACKUP | SPECIFY SPACE |
+----------------------------+---------------------+------------------+-------------+---------------+
| BACKUP_2021_07_29_06_51_09 | 2021-07-29 06:51:09 | basketballplayer | true | true |
| BACKUP_2021_07_29_07_55_08 | 2021-07-29 07:55:09 | basketballplayer | true | true |
+----------------------------+---------------------+------------------+-------------+---------------+
```
```bash
$ ./bin/br show --storage <ip_address>
```

例如,可以使用以下命令列出在本地 `/home/nebula/backup` 路径中的备份的信息。
```bash
$ ./bin/br show --storage "local:///home/nebula/backup"
+----------------------------+---------------------+------------------------+-------------+------------+
| NAME | CREATE TIME | SPACES | FULL BACKUP | ALL SPACES |
+----------------------------+---------------------+------------------------+-------------+------------+
| BACKUP_2022_02_10_07_40_41 | 2022-02-10 07:40:41 | basketballplayer | true | true |
| BACKUP_2022_02_11_08_26_43 | 2022-02-11 08:26:47 | basketballplayer,foesa | true | true |
+----------------------------+---------------------+------------------------+-------------+------------+
```

或使用以下命令列出在兼容 s3 协议的对象存储服务 `br-test` 桶下的`backup`中的备份的信息。
```bash
$ ./bin/br show --s3.endpoint "http://127.0.0.1:9000" --storage="s3://br-test/backup/" --s3.access_key=minioadmin --s3.secret_key=minioadmin --s3.region=default
```

以下列出命令的相关参数。

| 参数 | 数据类型 | 是否必需 | 默认值 | 说明 |
| --- | --- | --- | --- | --- |
| -h,-help | - | 否 | 无 | 查看帮助。 |
| --log | string | 否 | "br.log" | 日志路径。 |
| --storage | string | 是 | 无 | BR 备份数据存储位置,格式为:\<Schema\>://\<PATH\> <br>Schema:可选值为 `local` 和 `s3`。选择 s3 时,需要填写`s3.access_key`、`s3.endpoint`、`s3.region`和 `s3.secret_key`。<br>PATH:存储位置的路径。|
| --s3.access_key | string | 否 | 无 | 用于标识用户。 |
| --s3.endpoint | string | 否 | 无 | S3 对外服务的访问域名的 URL,指定 http 或 https。 |
| --s3.region | string | 否 | 无 | 数据中心所在物理位置。 |
| --s3.secret_key| string | 否 | 无 | 用户用于加密签名字符串和用来验证签名字符串的密钥,必须保密。 |

2. 用户可以使用以下命令恢复数据:
```
[root]# ./bin/br restore full --meta <ip_address> --storage <storage_path> --name <backup_name> --user <user_name>
```

例如,可以使用以下命令,将本地 `/home/foesa/backup` 路径中的数据恢复到地址为`192.168.*.*:9559`,meta/storage 服务所在主机的用户名为`root`的集群:

```
[root]# ./bin/br restore full --meta "192.168.*.*:9559" --storage "local:///home/test/backup" --name "BACKUP_2021_07_29_07_55_08" --user "root"
```
```
$ ./bin/br restore full --meta <ip_address> --storage <storage_path> --name <backup_name>
```

例如,可以使用以下命令,将本地 `/home/nebula/backup/` 路径中的数据恢复到为 meta 地址为`127.0.0.1:9559`集群中:

```
$ ./bin/br restore full --meta "127.0.0.1:9559" --storage "local:///home/nebula/backup/" --name BACKUP_2021_12_08_18_38_08
```

或者使用以下命令,将兼容 s3 协议的对象存储服务 `br-test` 桶下的`backup`的备份,恢复到 meta 服务的地址为`127.0.0.1:9559`的集群中。
```bash
br restore full --meta "127.0.0.1:9559" --s3.endpoint "http://127.0.0.1:9000" --storage="s3://br-test/backup/" --s3.access_key=minioadmin --s3.secret_key=minioadmin --s3.region="default" --name BACKUP_2021_12_08_18_38_08
```

如果返回如下信息,表示数据已经恢复成功。
```bash
restore successed
```
如果返回如下信息,表示数据已经恢复成功。
```bash
Restore succeed.
```

以下列出命令的相关参数。

| 参数 | 是否必需 | 默认值 | 说明 | 数据类型 |
| --- | --- | --- | --- | --- |
| --concurrent | 否 | 5 | 针对阿里云 OSS 最大并发数。 | int |
| --extra_args | 否 | 无 | 备份存储工具(OSS/HDFS/S3)用于备份的参数。 | string |
| -h,-help | 否 | 无 | 查看帮助。 | - |
| --meta | 是 | 无 | meta 服务的地址和端口号。 | string |
| --name | 是 | 无 | 备份名字。 | string |
| --storage | 是 | 无 | BR 备份数据存储路径。 | string |
| --user | 是 | 无 | 登录到 meta/storage 服务所在主机的用户名。 | string |
!!! caution

如果用户新集群的IP和备份集群不同,在恢复集群后需要使用`add host`向新集群中添加 Storage 主机。

以下列出命令的相关参数。

| 参数 | 数据类型 | 是否必需 | 默认值 | 说明 |
| --- | --- | --- | --- | --- |
| -h,-help | - | 否 | - | 查看帮助。 |
| --log | string | 否 | "br.log" | 日志路径。 |
| --meta | string |是| 无 | meta 服务的地址和端口号。 |
| --name | string | 是 | 无 | 备份名字。 |
| --storage | string | 是 | 无 | BR 备份数据存储位置,格式为:\<Schema\>://\<PATH\> <br>Schema:可选值为 `local` 和 `s3`。选择 s3 时,需要填写`s3.access_key`、`s3.endpoint`、`s3.region`和 `s3.secret_key`。<br>PATH:存储位置的路径。|
| --s3.access_key | string | 否 | 无 | 用于标识用户。 |
| --s3.endpoint | string | 否 | 无 | S3 对外服务的访问域名的 URL,指定 http 或 https。 |
| --s3.region | string | 否 | 无 | 数据中心所在物理位置。 |
| --s3.secret_key| string | 否 | 无 | 用户用于加密签名字符串和用来验证签名字符串的密钥,必须保密。 |

3. 如果在备份期间发现任何错误,用户可以使用以下命令清理临时文件。该命令将清理集群和外部存储中的文件,同时用户也可以使用该命令清理外部存储中的旧的备份文件。

```
$ ./bin/br cleanup --meta <ip_address> --storage <storage_path> --name <backup_name>
```

以下列出命令的相关参数。

| 参数 | 数据类型 | 是否必需 | 默认值 | 说明 |
| --- | --- | --- | --- | --- |
| -h,-help | - | 否 | - | 查看帮助。 |
| --log | string | 否 | "br.log" | 日志路径。 |
| --meta | string |是| 无 | meta 服务的地址和端口号。 |
| --name | string | 是 | 无 | 备份名字。 |
| --storage | string | 是 | 无 | BR 备份数据存储位置,格式为:\<Schema\>://\<PATH\> <br>Schema:可选值为 `local` 和 `s3`。选择 s3 时,需要填写`s3.access_key`、`s3.endpoint`、`s3.region`和 `s3.secret_key`。<br>PATH:存储位置的路径。|
| --s3.access_key | string | 否 | 无 | 用于标识用户。 |
| --s3.endpoint | string | 否 | 无 | S3 对外服务的访问域名的 URL,指定 http 或 https。 |
| --s3.region | string | 否 | 无 | 数据中心所在物理位置。 |
| --s3.secret_key| string | 否 | 无 | 用户用于加密签名字符串和用来验证签名字符串的密钥,必须保密。 |