Skip to content

Commit

Permalink
add zone doc (#1053)
Browse files Browse the repository at this point in the history
* add zone doc

* update

* update

* update

* update

* update

* update

Co-authored-by: foesa <[email protected]>
  • Loading branch information
cooper-lzy and foesa-yang authored Oct 22, 2021
1 parent 3fbc367 commit e0a53eb
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

|语法|说明|
|:---|:---|
|`BALANCE DATA`|启动任务均衡分布Nebula Graph集群里的所有分片。该命令会返回任务ID(`balance_id`)。|
|`BALANCE DATA`|启动任务均衡分布Nebula Graph集群中(或Group中)的所有分片。该命令会返回任务ID(`balance_id`)。|
|`BALANCE DATA <balance_id>`|显示`BALANCE DATA`任务的状态。|
|`BALANCE DATA STOP`|停止`BALANCE DATA`任务。|
|`BALANCE DATA REMOVE <host_list>`|在Nebula Graph集群中扫描并解绑指定的Storage主机。|
|`BALANCE LEADER`|在Nebula Graph集群中均衡分布leader|
|`BALANCE LEADER`|在Nebula Graph集群中(或Group中)均衡分布leader|
2 changes: 2 additions & 0 deletions docs-2.0/3.ngql-guide/9.space-statements/1.create-space.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ CREATE SPACE [IF NOT EXISTS] <graph_space_name> (
[replica_factor = <replica_number>,]
vid_type = {FIXED_STRING(<N>) | INT[64]}
)
[ON <group_name>]
[COMMENT = '<comment>'];
```

Expand All @@ -26,6 +27,7 @@ CREATE SPACE [IF NOT EXISTS] <graph_space_name> (
|`partition_num`|指定图空间的分片数量。建议设置为5倍的集群硬盘数量。例如集群中有3个硬盘,建议设置15个分片。默认值为100。|
|`replica_factor`|指定每个分片的副本数量。建议在生产环境中设置为3,在测试环境中设置为1。由于需要基于多数表决,副本数量必须是**奇数**。默认值为1。|
|`vid_type`|必选参数。指定点ID的数据类型。可选值为`FIXED_STRING(<N>)``INT64``INT`等同于`INT64``FIXED_STRING(<N>)`表示数据类型为字符串,最大长度为`N`,超出长度会报错;`INT64`表示数据类型为整数。|
|`ON <group_name>`|指定图空间所属的Group。详情请参见[Group&Zone](../../7.data-security/5.zone.md)|
|`COMMENT`|图空间的描述。最大为256字节。默认无描述。|

!!! caution
Expand Down
173 changes: 173 additions & 0 deletions docs-2.0/7.data-security/5.zone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# Group&Zone

Nebula Graph提供Group&Zone功能,可以将Storage节点进行分组管理,实现资源隔离。

## 背景信息

用户可以将Storage节点加入某个Zone中,多个Zone构成一个Group。创建图空间时指定Group,就会在Group内的Storage节点上创建及存储图空间。分片及其副本会均匀存储在各个Zone中。如下图所示。

![Group&Zone示意图](zone1.png)

8台启动Storage服务的机器两两组合,加入4个Zone。然后将Zone1、Zone2、Zone3加入Group1,Zone3、Zone4加入Group2。

指定Group1创建图空间S1,分片及其副本会均匀存储在Zone1~Zone3,不会存储到Zone4的机器上。

指定Group2创建图空间S2,分片及其副本会均匀存储在Zone3~Zone4。不会存储到Zone1和Zone2的机器上。

上述例子简单介绍了Zone功能,用户可以通过合理规划Zone和Group,实现资源隔离。

## 适用场景

- 期望将图空间创建在某些指定的Storage节点上,从而达到资源隔离的目的。

- 集群滚动升级。需要停止一个或多个服务器并更新,然后重新投入使用,直到集群中所有的节点都更新为新版本。

## 注意事项

- Zone是Storage节点的集合,每个Storage节点只能加入一个Zone。

- Zone中可以存储分片的副本,但同一个分片在一个Zone中只能有一个副本。

- 多个Zone可以组成一个Group,方便管理,并且可以进行资源隔离。

- 一个Zone可以加入多个Group。

- 创建Space时如果指定Group,该图空间的副本将均匀分布在该Group的各个Zone中。

- 一个Group可以创建多个图空间,但是Group中Zone的数量需要大于等于创建图空间时指定的副本数(`replica_factor`)。

## 基本语法

### ADD ZONE

创建Zone,并将Storage节点加入Zone。

```ngql
ADD ZONE <zone_name> <host1>:<port1> [,<host2>:<port2>...];
```

示例:

```ngql
nebula> ADD ZONE zone1 192.168.8.111:9779, 192.168.8.129:9779;
```

### ADD HOST...INTO ZONE

将单个Storage节点加入已创建的Zone。

!!! note

加入之后请使用[BALANCE](../3.ngql-guide/18.operation-and-maintenance-statements/2.balance-syntax.md)命令实现负载均衡。

```ngql
ADD HOST <host1>:<port1> INTO ZONE <zone_name>;
```

### DROP HOST...FROM ZONE

从Zone中删除单个Storage节点。

!!! note

Group中正在使用的Storage节点无法直接删除,需要先删除关联的图空间,才能删除Storage节点。

```ngql
DROP HOST <host1>:<port1> FROM ZONE <zone_name>;
```

### SHOW ZONES

查看所有Zone。

```ngql
SHOW ZONES;
```

### DESCRIBE ZONE

查看指定Zone。

```ngql
DESCRIBE ZONE <zone_name>;
DESC ZONE <zone_name>;
```

### DROP ZONE

删除Zone。

!!! note

已加入Group的Zone无法直接删除,需要先从Group中剔除该Zone,或删除所属的Group后,才能删除Zone。

```ngql
DROP ZONE <zone_name>;
```

### ADD GROUP

创建Group,并将Zone加入Group。

```ngql
ADD GROUP <group_name> <zone_name> [,<zone_name>...];
```

示例:

```ngql
nebula> ADD GROUP group1 zone1,zone2;
```

### ADD ZONE...INTO GROUP

将单个Zone加入已创建的Group。

!!! note

加入之后请使用[BALANCE](../3.ngql-guide/18.operation-and-maintenance-statements/2.balance-syntax.md)命令实现负载均衡。

```ngql
ADD ZONE <zone_name> INTO GROUP <group_name>;
```

### DROP ZONE...FROM GROUP

从GROUP中删除单个Zone。

!!! note

Group中正在使用的Zone无法直接删除,需要先删除关联的图空间,才能删除Zone。

```ngql
DROP ZONE <zone_name> FROM GROUP <group_name>;
```

### SHOW GROUPS

查看所有Group。

```ngql
SHOW GROUPS;
```

### DESCRIBE GROUP

查看指定Group。

```ngql
DESCRIBE GROUP <group_name>;
DESC GROUP <group_name>;
```

### DROP GROUP

删除Group。

!!! note

正在使用的Group无法直接删除,需要先删除关联的图空间,才能删除Group。

```ngql
DROP GROUP <group_name>;
```
Binary file added docs-2.0/7.data-security/zone1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ nav:
# - 使用BR备份数据: 7.data-security/2.backup-restore/3.br-backup-data.md
# - 使用BR恢复数据: 7.data-security/2.backup-restore/4.br-restore-data.md
- 管理快照: 7.data-security/3.manage-snapshot.md
- Group&Zone: 7.data-security/5.zone.md
- SSL加密: 7.data-security/4.ssl.md

- 最佳实践:
Expand Down

0 comments on commit e0a53eb

Please sign in to comment.