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

only-root-can-sign-in-drainer-in-master-cluster&add multiple listener, drainer #2443

Merged
merged 6 commits into from
Jan 11, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ NebulaGraph 支持在集群间进行数据同步,即主集群 A 的数据可

- 从集群中数据如果不为空,数据同步时可能会导致数据冲突或者数据不一致。建议保持从集群数据为空。

- 建议使用具备 God 权限的`root`用户进行集群数据同步操作。集群同步操作中各命令需要的用户角色权限不同,详情参见文末的**权限说明**。

- 在数据同步期间,请勿同时在主集群进行数据恢复(备份恢复和快照恢复)操作,否则数据同步将失败。


## 操作步骤

### 准备工作
Expand Down Expand Up @@ -172,6 +175,10 @@ drainer:机器 IP 地址为`192.168.10.104`,只启动 drainer 服务。
+-----------+------------------+------+
```

!!! note

注册多个 drainer 服务的命令示例:`SIGN IN DRAINER SERVICE(192.168.8.x:9889),(192.168.8.x:9889)`

3. 设置 listener 服务。

```
Expand Down Expand Up @@ -201,6 +208,10 @@ drainer:机器 IP 地址为`192.168.10.104`,只启动 drainer 服务。
+--------+--------+------------------------+--------------------------------+----------+
```

!!! note

添加多个 Storage listener 服务的命令示例:`ADD LISTENER SYNC META 192.168.10.xxx:9569 STORAGE 192.168.10.xxx:9789,192.168.10.xxx:9789 TO SPACE replication_basketballplayer`

4. 登录从集群,创建图空间`replication_basketballplayer`。

```
Expand All @@ -222,6 +233,10 @@ drainer:机器 IP 地址为`192.168.10.104`,只启动 drainer 服务。
+-------------------------+----------+
```

!!! note

添加多个 drainer 服务的命令示例:`ADD DRAINER 192.168.8.x:9889,192.168.8.x:9889`

6. 修改图空间`replication_basketballplayer`为只读。

!!! note
Expand All @@ -239,7 +254,6 @@ drainer:机器 IP 地址为`192.168.10.104`,只启动 drainer 服务。
| "read_only" | "bool" | true |
+-------------+--------+-------+
```

### 3.验证数据

1. 登录主集群,创建 Schema,插入数据。
Expand Down Expand Up @@ -486,6 +500,21 @@ nebula> SHOW DRAINER SYNC STATUS;

至此主从集群切换完成。

## 权限说明

集群同步操作中各命令需要的用户角色权限不同,不同命令所需的角色权限如下(打勾代表有权限)。

| 命令 | God | Admin | DBA | User | Guest |
| ------------------------------------ | ---- | ----- | ---- | ---- | ----- |
| `SIGN IN / SIGN OUT DRAINER SERVICE` | √ | | | | |
| `ADD / REMOVE LISTENER SYNC` | √ | √ | √ | | |
| `SHOW DRAINER CLIENTS` | √ | √ | √ | √ | √ |
| `SHOW LISTENER SYNC` | √ | √ | √ | √ | √ |
| `ADD / REMOVE DRAINER` | √ | √ | √ | | |
| `SET VARIABLES read_only` | √ | | | | |
| `SHOW DRAINERS` | √ | √ | √ | √ | √ |


## 常见问题

### 主集群中已经有 data 了,从集群可以同步到之前的存量 data 吗?
Expand Down