Skip to content

Commit

Permalink
[Doc] Update Description in BE labels (backport #48372) (#48447)
Browse files Browse the repository at this point in the history
Co-authored-by: yingtingdong <[email protected]>
  • Loading branch information
mergify[bot] and yingtingdong authored Jul 24, 2024
1 parent 6fe09a6 commit b3aff31
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ displayed_sidebar: "English"

# Add labels on BEs

Since v3.2.8, StarRocks supports adding labels on BEs. If you specify labels at table creation, identical replicas are evenly distributed across different labels, and also evenly distributed within the BEs of the same label. This feature can enhance data high availability and isolate resource.
Since v3.2.8, StarRocks supports adding labels on BEs. When creating a table or an asynchronous materialized view, you can specify the label of a certain group of BE nodes. This ensures that data replicas are distributed only on the BE nodes associated with that label. Data replicas will be evenly distributed among nodes with the same label, enhancing data high availability and resource isolation.

## Usage

Expand All @@ -25,22 +25,22 @@ After adding labels, you can execute `SHOW BACKENDS;` and view the labels of BEs

If you need to modify the labels of BEs, you can execute `ALTER SYSTEM MODIFY BACKEND "172.xx.xx.48:9050" SET ("labels.location" = "rack:xxx");`.

### Add labels on tables
### Use labels to specify table data distribution on BE nodes

If you need to specify the locations to which a table's data is distributed, for example, distributing a table's data across two racks, rack1 and rack2, you can add labels to the table.

After labels are added, all the replicas of the same tablet in the table are distributed across labels in a Round-Robin approach. Moreover, if multiple replicas of the same tablet exist within the same label, these replicas will be distributed as evenly as possible across different BEs in that label.

:::note

- The total number of BEs in the labels where the table resides must be greater than the number of replicas. Otherwise, an error `Table replication num should be less than or equal to the number of available BE nodes` will occur.
- The labels added to the table must already exist. Otherwise, an error `Getting analyzing error. Detail message: Cannot find any backend with location: rack:xxx` will occur.
- The total number of BE nodes associated with the labels must be greater than the number of replicas. Otherwise, an error `Table replication num should be less than or equal to the number of available BE nodes` will occur.
- The label to be associated with a table must already exist. Otherwise, an error `Getting analyzing error. Detail message: Cannot find any backend with location: rack:xxx` will occur.

:::

#### At table creation

If you want to distribute the table's data across rack 1 and rack 2 at table creation, you can execute the following statement:
You can use the property `"labels.location"` to distribute the table's data across rack 1 and rack 2 at table creation:

```SQL
CREATE TABLE example_table (
Expand Down Expand Up @@ -77,16 +77,16 @@ ALTER TABLE example_table1

:::

### Add labels on asynchronous materialized views
### Use labels to specify materialized view data distribution on BE nodes

If you need to specify the locations to which an asynchronous materialized view's data is distributed, for example, distributing data across two racks, rack1 and rack2, you can add labels to the materialized view.

After labels are added, all the replicas of the same tablet in the materialized view are distributed across labels in a Round-Robin approach. Moreover, if multiple replicas of the same tablet exist within the same label, these replicas will be distributed as evenly as possible across different BEs in that label.

:::note

- The total number of BEs in the labels where the materialized view resides must be greater than the number of replicas. Otherwise, an error `Table replication num should be less than or equal to the number of available BE nodes` will occur.
- The labels added to the materialized view must already exist. Otherwise, an error `Getting analyzing error. Detail message: Cannot find any backend with location: rack:xxx` will occur.
- The total number of BE nodes associated with the labels must be greater than the number of replicas. Otherwise, an error `Table replication num should be less than or equal to the number of available BE nodes` will occur.
- The labels to be associated with the materialized view must already exist. Otherwise, an error `Getting analyzing error. Detail message: Cannot find any backend with location: rack:xxx` will occur.

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ displayed_sidebar: "Chinese"

# 使用标签管理 BE 节点

自 3.2.8 版本起,StarRocks 支持使用标签对 BE 节点进行分组。如果您在建表时指定标签,则相同副本均衡分布在各个标签中,同时相同副本也均衡分布在同一标签内的 BE 节点中。该特性可以提高数据高可用和隔离资源等
自 3.2.8 版本起,StarRocks 支持使用标签对 BE 节点进行分组。您在建表或创建异步物化视图时可以通过指定和 BE 节点相同标签来使数据副本分布到指定的标签所对应的 BE 节点上。数据副本在相同标签的节点下会均匀分布,该特性可以提高数据高可用和资源隔离性能

## 使用方式

Expand All @@ -25,22 +25,22 @@ ALTER SYSTEM MODIFY BACKEND "172.xx.xx.51:9050" SET ("labels.location" = "rack:r

如果需要修改 BE 节点的标签,可以执行 `ALTER SYSTEM MODIFY BACKEND "172.xx.xx.48:9050" SET ("labels.location" = "rack:xxx");`

### 为表添加标签
### 使用标签指定表的数据在 BE 节点上的分布

如果您需要指定表的数据分布的位置,比如分布在两个机架中 rack1 和 rack2,则您可以为表添加标签。

添加标签后,表中相同 Tablet 的副本按 Round Robin 的方式选取所在的标签。并且同一标签中如果同一 Tablet 的副本存在多个,则这些同一 Tablet 的多个副本会尽可能均匀分布在该标签内的不同的 BE 节点上。

:::note

- 表所在标签中的全部 BE 节点数必须大于副本数,否则会报错 `Table replication num should be less than of equal to the number of available BE nodes`.
- 为表添加的标签必须已经存在,否则会报错 `Getting analyzing error. Detail message: Cannot find any backend with location: rack:xxx`.
- 为表指定的标签所包含的 BE 节点数必须大于副本数,否则会报错 `Table replication num should be less than of equal to the number of available BE nodes`.
- 为表指定的标签必须已经存在,否则会报错 `Getting analyzing error. Detail message: Cannot find any backend with location: rack:xxx`.

:::

#### 建表时

建表时指定表的数据分布在 rack 1 和 rack 2,则可以执行如下语句
建表时指定表的数据分布在 rack 1 和 rack 2,可以通过设置表属性 `"labels.location"` 的值来指定数据分布的标签

```SQL
CREATE TABLE example_table (
Expand Down Expand Up @@ -79,16 +79,16 @@ ALTER TABLE example_table1

:::

### 为异步物化视图添加标签
### 使用标签指定物化视图的数据在 BE 节点上的分布

如果您需要指定异步物化视图的数据分布的位置,比如分布在两个机架中 rack1 和 rack2,则您可以为物化视图添加标签。

添加标签后,物化视图中相同 Tablet 的副本按 Round Robin 的方式选取所在的标签。并且同一标签中如果同一 Tablet 的副本存在多个,则这些同一 Tablet 的多个副本会尽可能均匀分布在该标签内的不同的 BE 节点上。

:::note

- 物化视图所在标签中的全部 BE 节点数必须大于副本数,否则会报错 `Table replication num should be less than of equal to the number of available BE nodes`.
- 为物化视图添加的标签必须已经存在,否则会报错 `Getting analyzing error. Detail message: Cannot find any backend with location: rack:xxx`.
- 为物化视图指定的标签所包含的 BE 节点数必须大于副本数,否则会报错 `Table replication num should be less than of equal to the number of available BE nodes`.
- 为物化视图指定的标签必须已经存在,否则会报错 `Getting analyzing error. Detail message: Cannot find any backend with location: rack:xxx`.

:::

Expand Down

0 comments on commit b3aff31

Please sign in to comment.