This is an automated email from the ASF dual-hosted git repository. yongzao pushed a commit to branch Heterogeneous-Database-document in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit ec86a6c7fc4ac37469d22488be1ba07e6232bb92 Author: YongzaoDan <[email protected]> AuthorDate: Wed Jun 21 14:32:27 2023 +0800 Finish --- docs/UserGuide/Operate-Metadata/Database.md | 82 ++++++++++++++++++++++++++ docs/zh/UserGuide/Operate-Metadata/Database.md | 81 +++++++++++++++++++++++++ 2 files changed, 163 insertions(+) diff --git a/docs/UserGuide/Operate-Metadata/Database.md b/docs/UserGuide/Operate-Metadata/Database.md index 029cb7b63b3..0d45a9d1c03 100644 --- a/docs/UserGuide/Operate-Metadata/Database.md +++ b/docs/UserGuide/Operate-Metadata/Database.md @@ -135,3 +135,85 @@ It costs 0.002s Total line number = 1 It costs 0.002s ``` + +### Setting up heterogeneous databases (Advanced operations) + +Under the premise of familiar with IoTDB metadata modeling, +users can set up heterogeneous databases in stand-alone/distributed IoTDB to +cope with different production needs. + +Currently, the following database heterogeneous parameters are supported: + +| Parameter | Type | Description | +|---------------------------|---------|-----------------------------------------------| +| TTL | Long | TTL of the Database | +| TIME_PARTITION_INTERVAL | Long | Time partition interval of the Database | +| SCHEMA_REPLICATION_FACTOR | Integer | The schema replication number of the Database | +| DATA_REPLICATION_FACTOR | Integer | The data replication number of the Database | +| SCHEMA_REGION_GROUP_NUM | Integer | The SchemaRegionGroup number of the Database | +| DATA_REGION_GROUP_NUM | Integer | The DataRegionGroup number of the Database | + +Note the following when configuring heterogeneous parameters: ++ TTL and TIME_PARTITION_INTERVAL must be positive integers. ++ SCHEMA_REPLICATION_FACTOR and DATA_REPLICATION_FACTOR takes effect only in distributed IoTDB. ++ The function of SCHEMA_REGION_GROUP_NUM and DATA_REGION_GROUP_NUM are related to the parameter `schema_region_group_extension_policy` and `data_region_group_extension_policy` in iotdb-common.properties configuration file. + If `region_group_extension_policy=CUSTOM` is set, REGION_GROUP_NUM serves as the number of RegionGroups owned by the Database. + If `region_group_extension_policy=AUTO`, REGION_GROUP_NUM is used as the lower bound of the RegionGroup quota owned by the Database. That is, when the Database starts writing data, it will have at least this number of RegionGroups. + +Users can set any heterogeneous parameters when creating a Database, or adjust some heterogeneous parameters during a stand-alone/distributed IoTDB run. + +#### Set heterogeneous parameters when creating a Database + +The user can set any of the above heterogeneous parameters when creating a Database. The SQL statement is as follows: + +``` +CREATE DATABASE DatabaseName WITH SCHEMA_REPLICATION_FACTOR=1, DATA_REPLICATION_FACTOR=3, SCHEMA_REGION_GROUP_NUM=1, DATA_REGION_GROUP_NUM=2; +``` + +#### 运行时调整异构参数 + +Users can adjust some heterogeneous parameters during the stand-alone/distributed IoTDB run, as shown in the following SQL statement: + +``` +ALTER DATABASE DatabaseName WITH SCHEMA_REGION_GROUP_NUM=1, DATA_REGION_GROUP_NUM=2; +``` + +Note that only the following heterogeneous parameters can be adjusted at runtime: ++ SCHEMA_REGION_GROUP_NUM ++ DATA_REGION_GROUP_NUM + +#### 查看异构数据库 + +The user can query the specific heterogeneous configuration of each Database, and the SQL statement is as follows: + +``` +SHOW DATABASES DETAILS prefixPath? +``` + +For example: + +``` +IoTDB> SHOW DATABASES DETAILS ++--------+--------+-----------------------+---------------------+---------------------+--------------------+-----------------------+-----------------------+------------------+---------------------+---------------------+ +|Database| TTL|SchemaReplicationFactor|DataReplicationFactor|TimePartitionInterval|SchemaRegionGroupNum|MinSchemaRegionGroupNum|MaxSchemaRegionGroupNum|DataRegionGroupNum|MinDataRegionGroupNum|MaxDataRegionGroupNum| ++--------+--------+-----------------------+---------------------+---------------------+--------------------+-----------------------+-----------------------+------------------+---------------------+---------------------+ +|root.db1| null| 1| 3| 604800000| 0| 1| 1| 0| 2| 2| +|root.db2|86400000| 1| 1| 86400000| 0| 1| 1| 0| 2| 2| +|root.db3| null| 1| 1| 604800000| 0| 1| 1| 0| 2| 2| ++--------+--------+-----------------------+---------------------+---------------------+--------------------+-----------------------+-----------------------+------------------+---------------------+---------------------+ +Total line number = 3 +It costs 0.058s +``` + +The query results in each column are as follows: ++ The name of the Database ++ The TTL of the Database ++ The schema replication number of the Database ++ The data replication number of the Database ++ The time partition interval of the Database ++ The current SchemaRegionGroup number of the Database ++ The required minimum SchemaRegionGroup number of the Database ++ The permitted maximum SchemaRegionGroup number of the Database ++ The current DataRegionGroup number of the Database ++ The required minimum DataRegionGroup number of the Database ++ The permitted maximum DataRegionGroup number of the Database \ No newline at end of file diff --git a/docs/zh/UserGuide/Operate-Metadata/Database.md b/docs/zh/UserGuide/Operate-Metadata/Database.md index 75ea79cf22e..720420cb4a9 100644 --- a/docs/zh/UserGuide/Operate-Metadata/Database.md +++ b/docs/zh/UserGuide/Operate-Metadata/Database.md @@ -135,3 +135,84 @@ It costs 0.002s Total line number = 1 It costs 0.002s ``` + +### 设置异构数据库(进阶操作) + +在熟悉 IoTDB 元数据建模的前提下,用户可以在单机/分布式 IoTDB 中设置异构的数据库,以便应对不同的生产需求。 + +目前支持的数据库异构参数有: + +| 参数名 | 参数类型 | 参数描述 | +|---------------------------|---------|---------------------------| +| TTL | Long | 数据库的 TTL | +| TIME_PARTITION_INTERVAL | Long | 数据库的时间分区间隔 | +| SCHEMA_REPLICATION_FACTOR | Integer | 数据库的元数据副本数 | +| DATA_REPLICATION_FACTOR | Integer | 数据库的数据副本数 | +| SCHEMA_REGION_GROUP_NUM | Integer | 数据库的 SchemaRegionGroup 数量 | +| DATA_REGION_GROUP_NUM | Integer | 数据库的 DataRegionGroup 数量 | + +用户在配置异构参数时需要注意以下三点: ++ TTL 和 TIME_PARTITION_INTERVAL 必须为正整数 ++ SCHEMA_REPLICATION_FACTOR 和 DATA_REPLICATION_FACTOR 仅在分布式 IoTDB 中生效。 ++ SCHEMA_REGION_GROUP_NUM 和 DATA_REGION_GROUP_NUM 的功能与 iotdb-common.properties 配置文件中的 +`schema_region_group_extension_policy` 和 `data_region_group_extension_policy` 参数相关, +若设置 `region_group_extension_policy=CUSTOM`,则 REGION_GROUP_NUM 将作为 Database 拥有的 RegionGroup 的数量; +若设置 `region_group_extension_policy=AUTO`,则 REGION_GROUP_NUM 将作为 Database 拥有的 RegionGroup 的配额下界,即当该 Database 开始写入数据时,将至少拥有此数量的 RegionGroup。 + +用户可以在创建 Database 时设置任意异构参数,或在单机/分布式 IoTDB 运行时调整部分异构参数。 + +#### 创建 Database 时设置异构参数 + +用户可以在创建 Database 时设置上述任意异构参数,SQL 语句如下所示: + +``` +CREATE DATABASE DatabaseName WITH SCHEMA_REPLICATION_FACTOR=1, DATA_REPLICATION_FACTOR=3, SCHEMA_REGION_GROUP_NUM=1, DATA_REGION_GROUP_NUM=2; +``` + +#### 运行时调整异构参数 + +用户可以在单机/分布式 IoTDB 运行时调整部分异构参数,SQL 语句如下所示: + +``` +ALTER DATABASE DatabaseName WITH SCHEMA_REGION_GROUP_NUM=1, DATA_REGION_GROUP_NUM=2; +``` + +注意,运行时只能调整下列异构参数: ++ SCHEMA_REGION_GROUP_NUM ++ DATA_REGION_GROUP_NUM + +#### 查看异构数据库 + +用户可以查询每个 Database 的具体异构配置,SQL 语句如下所示: + +``` +SHOW DATABASES DETAILS prefixPath? +``` + +例如: + +``` +IoTDB> SHOW DATABASES DETAILS ++--------+--------+-----------------------+---------------------+---------------------+--------------------+-----------------------+-----------------------+------------------+---------------------+---------------------+ +|Database| TTL|SchemaReplicationFactor|DataReplicationFactor|TimePartitionInterval|SchemaRegionGroupNum|MinSchemaRegionGroupNum|MaxSchemaRegionGroupNum|DataRegionGroupNum|MinDataRegionGroupNum|MaxDataRegionGroupNum| ++--------+--------+-----------------------+---------------------+---------------------+--------------------+-----------------------+-----------------------+------------------+---------------------+---------------------+ +|root.db1| null| 1| 3| 604800000| 0| 1| 1| 0| 2| 2| +|root.db2|86400000| 1| 1| 86400000| 0| 1| 1| 0| 2| 2| +|root.db3| null| 1| 1| 604800000| 0| 1| 1| 0| 2| 2| ++--------+--------+-----------------------+---------------------+---------------------+--------------------+-----------------------+-----------------------+------------------+---------------------+---------------------+ +Total line number = 3 +It costs 0.058s +``` + +各列查询结果依次为: ++ 数据库名称 ++ 数据库的 TTL ++ 数据库的元数据副本数 ++ 数据库的数据副本数 ++ 数据库的时间分区间隔 ++ 数据库当前拥有的 SchemaRegionGroup 数量 ++ 数据库需要拥有的最小 SchemaRegionGroup 数量 ++ 数据库允许拥有的最大 SchemaRegionGroup 数量 ++ 数据库当前拥有的 DataRegionGroup 数量 ++ 数据库需要拥有的最小 DataRegionGroup 数量 ++ 数据库允许拥有的最大 DataRegionGroup 数量 \ No newline at end of file
