Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Apr 22, 2024
1 parent 7f43e1f commit 8fedf52
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 151 deletions.
72 changes: 6 additions & 66 deletions _docs/en/administration/table-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ If you want to view specific table environment variables, you need to use the [g
Table environment variables have the following characteristics:
* Persist the metadata of the table onto Apache Zookeeper.
* It can be dynamically modified through the command line, and once the modification is successful, it will be immediately updated to Zookeeper.
* Synchronize the variables though the periodic synchronization message `config_sync` between the meta server and the replica server to take effect on each replica server.
> Due to periodic synchronization, the updated environment variables may not take immediate effect on the replica server, but rather have a delay. This delay time depends on the value of the configuration 'config_sync_interval_ms', which defaults to 30 seconds.
* Synchronize the variables though the periodic synchronization message `config_sync` between the Meta Server and the Replica Server to take effect on each Replica Server.
> Due to periodic synchronization, the updated environment variables may not take immediate effect on the Replica Server, but rather have a delay. This delay time depends on the value of the configuration 'config_sync_interval_ms', which defaults to 30 seconds.
* The key of environmental variables is usually separated by `.` for easy classification.

The functions currently supported through table environment variables include:
Expand All @@ -36,79 +36,19 @@ Pegasus provides [Shell commands](/docs/tools/shell/) for manipulating table env
## get_app_envs

Get a list of environment variables, usage: `get_app_envs [-j|--json]`

示例:
```
>>> use temp
OK
>>> get_app_envs
[app_envs]
rocksdb.usage_scenario : normal
```
Refer to: [`get_app_envs` command](/docs/tools/shell/#get_app_envs)

## set_app_envs

设置环境变量,用法:`set_app_envs <key> <value> [key value...]`

示例:
```
>>> use temp
OK
>>> set_app_envs rocksdb.usage_scenario bulk_load
set app envs succeed
```
Refer to: [`set_app_envs` command](/docs/tools/shell/#set_app_envs)

## del_app_envs

删除环境变量,用法:`del_app_envs <key> [key...]`

示例:
```
>>> use temp
OK
>>> set_app_envs rocksdb.usage_scenario bulk_load
set app envs succeed
>>> del_app_envs rocksdb.usage_scenario
del app envs succeed
=============================
deleted keys:
rocksdb.usage_scenario
=============================
```
Refer to: [`del_app_envs` command](/docs/tools/shell/#del_app_envs)

## clear_app_envs

清空环境变量,或者叫批量删除环境变量,用法:`clear_app_envs <-a|--all> <-p|--prefix str>`

支持两种方式:
* 全部清理:使用 `-a` 选项。
* 通过前缀清理:使用 `-p` 选项指定前缀,匹配时会先自动在前缀后面加上 `.`,然后按照字符串前缀匹配。

譬如:
```
>>> use temp
OK
>>> set_app_envs manual_compact.once.trigger_time 1713700000
set app envs succeed
>>> set_app_envs manual_compact.once.target_level -1
set app envs succeed
>>> set_app_envs manual_compact.once.bottommost_level_compaction force
set app envs succeed
>>> set_app_envs rocksdb.usage_scenario bulk_load
set app envs succeed
>>> clear_app_envs -p manual_compact
clear app envs succeed
=============================
deleted keys:
manual_compact.once.bottommost_level_compaction
manual_compact.once.target_level
manual_compact.once.trigger_time
=============================
>>> get_app_envs
[app_envs]
rocksdb.usage_scenario : bulk_load
```
Refer to: [`clear_app_envs` command](/docs/tools/shell/#clear_app_envs)

# Supported environment variables

Expand Down
50 changes: 41 additions & 9 deletions _docs/en/tools/shell.md
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,10 @@ Examples:
| create | Create a table, with the option to add `-p` and `-r` to specify the number of partitions and replicas, respectively. The number of partitions must be a power of two. If `-r` is not specified, the default number of replicas is set to 3 (recommended value). |
| drop | Delete a table, refer to [use drop commands to delete a table](/administration/table-soft-delete#drop_commands). |
| recall | Restore a previously deleted table, refer to [use recall commands to recovery table](/administration/table-soft-delete#recall_commands). |
| get_app_envs | Retrieve the environmental variables of a table, refer to [Table environment#get_app_envs](/administration/table-env#get_app_envs). |
| set_app_envs | Set the environmental variables for a table, refer to [Table environment#set_app_envs](/administration/table-env#set_app_envs). |
| del_app_envs | Delete the environmental variables of a table, refer to [Table environment#del_app_envs](/administration/table-env#del_app_envs). |
| clear_app_envs | Clean up the environmental variables of a table, refer to [Table environment#clear_app_envs](/administration/table-env#clear_app_envs). |
| get_app_envs | Retrieve the environmental variables of a table. |
| set_app_envs | Set the environmental variables for a table. |
| del_app_envs | Delete the environmental variables of a table. |
| clear_app_envs | Clean up the environmental variables of a table. |
| add_dup | Add a cluster with duplication, refer to [duplication](/administration/duplication). |
| query_dup | Query the clusters for cross-data center synchronization of a table, refer to [duplication](/administration/duplication). |
| remove_dup | Remove a cluster with duplication, refer to [duplication](/administration/duplication). |
Expand Down Expand Up @@ -700,13 +700,16 @@ USAGE: get_app_envs

Explanation:

- This command outputs the current environmental variables of the table. Please use `use [app_name]` to select a specific table before executing this command. For reference, see [get_app_envs](/administration/table-env#get_app_envs).
- This command outputs the current environmental variables of the table. Please use `use [app_name]` to select a specific table before executing this command.

Examples:

```
>>> use temp
OK
>>> get_app_envs
[app_envs]
rocksdb.usage_scenario : normal
```

### set_app_envs
Expand All @@ -721,13 +724,15 @@ USAGE: set_app_envs <key> <value> [key value...]

Explanation:

- This command will set the current environmental variables of the table. Please use `use [app_name]` to select a specific table before executing this command. For reference, see [get_app_envs](/administration/table-env#get_app_envs).
- This command will set the current environmental variables of the table. Please use `use [app_name]` to select a specific table before executing this command.

Examples:

```
>>> use temp
OK
>>> set_app_envs rocksdb.usage_scenario bulk_load
set app envs succeed
```

### del_app_envs
Expand All @@ -742,13 +747,21 @@ USAGE: del_app_envs <key> [key...]

Explanation:

- This command delete the environmental variables of the current table. Please use `use [app_name]` to select a specific table before executing this command. For reference, see [get_app_envs](/administration/table-env#get_app_envs).
- This command deletes the environmental variables of the current table. Please use `use [app_name]` to select a specific table before executing this command.

Examples:

```
>>> use temp
OK
>>> set_app_envs rocksdb.usage_scenario bulk_load
set app envs succeed
>>> del_app_envs rocksdb.usage_scenario
del app envs succeed
=============================
deleted keys:
rocksdb.usage_scenario
=============================
```

### clear_app_envs
Expand All @@ -763,15 +776,34 @@ USAGE: clear_app_envs [-a|--all] [-p|--prefix str]

Explanation:

- This command eradicates the present table's environmental variables. Prior to employment, please ensure to employ `use [app_name]` to designate a specific table, as referenced in [clear_app_envs](/administration/table-env#clear_app_envs).
- This command eradicates the present table's environmental variables. Prior to employment, please ensure to employ `use [app_name]` to designate a specific table.
- The `-a` option: When specified, it results in the purging of all environmental variables.
- The `-p` option: When specified, it allows for the elimination of environmental variables with a specific prefix string.

Examples:

```
>>> use temp
>>> clear_app_envs -p rocksdb
OK
>>> set_app_envs manual_compact.once.trigger_time 1713700000
set app envs succeed
>>> set_app_envs manual_compact.once.target_level -1
set app envs succeed
>>> set_app_envs manual_compact.once.bottommost_level_compaction force
set app envs succeed
>>> set_app_envs rocksdb.usage_scenario bulk_load
set app envs succeed
>>> clear_app_envs -p manual_compact
clear app envs succeed
=============================
deleted keys:
manual_compact.once.bottommost_level_compaction
manual_compact.once.target_level
manual_compact.once.trigger_time
=============================
>>> get_app_envs
[app_envs]
rocksdb.usage_scenario : bulk_load
```

### add_dup
Expand Down
74 changes: 7 additions & 67 deletions _docs/zh/administration/table-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ app_id status app_name app_type partition_count replica_count is_statef
Table 环境变量具有如下特性:
* 作为 table 的元数据持久化到 Apache Zookeeper 上。
* 可以通过命令行动态修改,修改成功后会立即更新到 Apache Zookeeper 上。
* 通过 meta serverreplica server 的周期性同步消息 `config_sync` 同步给各个 replica server 生效。
> 由于是周期性同步,所以环境变量更新后可能不会在 replica server 上立即生效,而是有一个延迟。这个延迟时间依赖于配置 `config_sync_interval_ms` 的值,默认是 30 秒。
* 通过 Meta ServerReplica Server 的周期性同步消息 `config_sync` 同步给各个 Replica Server 生效。
> 由于是周期性同步,所以环境变量更新后可能不会在 Replica Server 上立即生效,而是有一个延迟。这个延迟时间依赖于配置 `config_sync_interval_ms` 的值,默认是 30 秒。
* 环境变量的 key 通常使用 `.` 分隔,方便分类。

目前通过 table 环境变量支持的功能如:
Expand All @@ -35,83 +35,23 @@ Pegasus 的 [Shell 工具](/docs/tools/shell/) 中提供了操作 table 环境

## get_app_envs

获取环境变量列表,用法:`get_app_envs [-j|--json]`

示例:
```
>>> use temp
OK
>>> get_app_envs
[app_envs]
rocksdb.usage_scenario : normal
```
参考:[`get_app_envs` 命令](/docs/tools/shell/#get_app_envs)

## set_app_envs

设置环境变量,用法:`set_app_envs <key> <value> [key value...]`

示例:
```
>>> use temp
OK
>>> set_app_envs rocksdb.usage_scenario bulk_load
set app envs succeed
```
参考:[`set_app_envs` 命令](/docs/tools/shell/#set_app_envs)

## del_app_envs

删除环境变量,用法:`del_app_envs <key> [key...]`

示例:
```
>>> use temp
OK
>>> set_app_envs rocksdb.usage_scenario bulk_load
set app envs succeed
>>> del_app_envs rocksdb.usage_scenario
del app envs succeed
=============================
deleted keys:
rocksdb.usage_scenario
=============================
```
参考:[`del_app_envs` 命令](/docs/tools/shell/#del_app_envs)

## clear_app_envs

清空环境变量,或者叫批量删除环境变量,用法:`clear_app_envs <-a|--all> <-p|--prefix str>`

支持两种方式:
* 全部清理:使用 `-a` 选项。
* 通过前缀清理:使用 `-p` 选项指定前缀,匹配时会先自动在前缀后面加上 `.`,然后按照字符串前缀匹配。

譬如:
```
>>> use temp
OK
>>> set_app_envs manual_compact.once.trigger_time 1713700000
set app envs succeed
>>> set_app_envs manual_compact.once.target_level -1
set app envs succeed
>>> set_app_envs manual_compact.once.bottommost_level_compaction force
set app envs succeed
>>> set_app_envs rocksdb.usage_scenario bulk_load
set app envs succeed
>>> clear_app_envs -p manual_compact
clear app envs succeed
=============================
deleted keys:
manual_compact.once.bottommost_level_compaction
manual_compact.once.target_level
manual_compact.once.trigger_time
=============================
>>> get_app_envs
[app_envs]
rocksdb.usage_scenario : bulk_load
```
参考:[`clear_app_envs` 命令](/docs/tools/shell/#clear_app_envs)

# 支持的环境变量

从 Pegasus 2.6 开始,可通过 meta server[HTTP 接口](/api/http) `/envs/list` 获取所有支持的 table 环境变量。
从 Pegasus 2.6 开始,可通过 Meta Server[HTTP 接口](/api/http) `/envs/list` 获取所有支持的 table 环境变量。
例如:

```
Expand Down
Loading

0 comments on commit 8fedf52

Please sign in to comment.