Skip to content

feat: add exclude, include, rebalance statements #205

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

Merged
merged 1 commit into from
Mar 14, 2025
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
9 changes: 9 additions & 0 deletions dir.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,15 @@
- title_en: COMPACT
title_cn: COMPACT
path: sql-reference/statements/compact
- title_en: EXCLUDE
title_cn: EXCLUDE
path: sql-reference/statements/exclude
- title_en: INCLUDE
title_cn: INCLUDE
path: sql-reference/statements/include
- title_en: REBALANCE
title_cn: REBALANCE
path: sql-reference/statements/rebalance
- title_en: Functions
title_cn: 函数
collapsed: true
Expand Down
21 changes: 21 additions & 0 deletions en_US/sql-reference/statements/exclude.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# EXCLUDE Statement

将指定的计算节点从集群中排除,被排除节点上的 partition 会迁移到其它节点,被排除的节点被 include 之前,不能分配新的 partition 到该节点上。

仅支持在集群模式下使用。

## 语法

### EXCLUDE NODE 'node_name'

```SQL
EXCLUDE NODE '127.0.0.1:8360'
```

待排除节点的名字可以通过 ```SHOW CLUSTER``` 指令查询到。

## 注意事项

* 被排除的节点不是必须处于 READY 状态,可以排除异常离线的节点;
* 不能重复 EXCLUDE 已经被 EXCLUDE 的节点,可以 INCLUDE 后再进行 EXCLUDE;
* 如果剩余节点不足以支持 partition 迁移,EXCLUDE 会失败。
19 changes: 19 additions & 0 deletions en_US/sql-reference/statements/include.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# INCLUDE Statement

消除被 EXCLUDE 节点的被排除状态,可以分配 partition 到 INCLUDE 的节点上。

仅支持在集群模式下使用。

## 语法

### INCLUDE NODE 'node_name'

```SQL
INCLUDE NODE '127.0.0.1:8360'
```

被排除节点的名字可以通过 ```SHOW CLUSTER``` 指令查询到。

## 注意事项

* 只允许 INCLUDE 被 EXCLUDE 排除的节点。
31 changes: 31 additions & 0 deletions en_US/sql-reference/statements/rebalance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# REBALANCE Statement

对服务器节点上 table 的 partitions 进行重新分布,提高服务器集群的负载均衡性。

仅支持在集群模式下使用。

## 语法

### REBALANCE

```SQL
REBALANCE
```

对所有数据库的所有 table 进行重新分布。

### REBALANCE DATABASE

```SQL
REBALANCE DATABASE db_name
```

对指定数据库为 db_name 中的所有 table 进行重新分布。

### REBALANCE TABLE

```SQL
REBALANCE TABLE table_name
```

对指定 table 的所有 partition 进行重新分布。
21 changes: 21 additions & 0 deletions zh_CN/sql-reference/statements/exclude.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# EXCLUDE Statement

将指定的计算节点从集群中排除,被排除节点上的 partition 会迁移到其它节点,被排除的节点被 include 之前,不能分配新的 partition 到该节点上。

仅支持在集群模式下使用。

## 语法

### EXCLUDE NODE 'node_name'

```SQL
EXCLUDE NODE '127.0.0.1:8360'
```

待排除节点的名字可以通过 ```SHOW CLUSTER``` 指令查询到。

## 注意事项

* 被排除的节点不是必须处于 READY 状态,可以排除异常离线的节点;
* 不能重复 EXCLUDE 已经被 EXCLUDE 的节点,可以 INCLUDE 后再进行 EXCLUDE;
* 如果剩余节点不足以支持 partition 迁移,EXCLUDE 会失败。
19 changes: 19 additions & 0 deletions zh_CN/sql-reference/statements/include.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# INCLUDE Statement

消除被 EXCLUDE 节点的被排除状态,可以分配 partition 到 INCLUDE 的节点上。

仅支持在集群模式下使用。

## 语法

### INCLUDE NODE 'node_name'

```SQL
INCLUDE NODE '127.0.0.1:8360'
```

被排除节点的名字可以通过 ```SHOW CLUSTER``` 指令查询到。

## 注意事项

* 只允许 INCLUDE 被 EXCLUDE 排除的节点。
31 changes: 31 additions & 0 deletions zh_CN/sql-reference/statements/rebalance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# REBALANCE Statement

对服务器节点上 table 的 partitions 进行重新分布,提高服务器集群的负载均衡性。

仅支持在集群模式下使用。

## 语法

### REBALANCE

```SQL
REBALANCE
```

对所有数据库的所有 table 进行重新分布。

### REBALANCE DATABASE

```SQL
REBALANCE DATABASE db_name
```

对指定数据库为 db_name 中的所有 table 进行重新分布。

### REBALANCE TABLE

```SQL
REBALANCE TABLE table_name
```

对指定 table 的所有 partition 进行重新分布。