diff --git a/src/.vuepress/sidebar/V1.3.x/en.ts b/src/.vuepress/sidebar/V1.3.x/en.ts index a180111f5..92373b0e4 100644 --- a/src/.vuepress/sidebar/V1.3.x/en.ts +++ b/src/.vuepress/sidebar/V1.3.x/en.ts @@ -129,7 +129,7 @@ export const enSidebar = { children: [ { text: 'Query Performance Analysis', link: 'Query-Performance-Analysis' }, { text: 'Load Balance', link: 'Load-Balance' }, - { text: 'Data Recovery', link: 'Data-Recovery' }, + { text: 'Maintenance statement', link: 'Maintenance-commands' }, ], }, ], diff --git a/src/.vuepress/sidebar/V1.3.x/zh.ts b/src/.vuepress/sidebar/V1.3.x/zh.ts index d6ff7ed59..2318134c1 100644 --- a/src/.vuepress/sidebar/V1.3.x/zh.ts +++ b/src/.vuepress/sidebar/V1.3.x/zh.ts @@ -118,7 +118,7 @@ export const zhSidebar = { children: [ { text: '查询性能分析', link: 'Query-Performance-Analysis' }, { text: '负载均衡', link: 'Load-Balance' }, - { text: '数据修复', link: 'Data-Recovery' }, + { text: '运维语句', link: 'Maintenance-statement' }, ], }, ], diff --git a/src/.vuepress/sidebar/V2.0.x/en-Tree.ts b/src/.vuepress/sidebar/V2.0.x/en-Tree.ts index 64a602e3d..347a2c4ac 100644 --- a/src/.vuepress/sidebar/V2.0.x/en-Tree.ts +++ b/src/.vuepress/sidebar/V2.0.x/en-Tree.ts @@ -120,7 +120,7 @@ export const enSidebar = { children: [ { text: 'Query Performance Analysis', link: 'Query-Performance-Analysis' }, { text: 'Load Balance', link: 'Load-Balance' }, - { text: 'Data Recovery', link: 'Data-Recovery' }, + { text: 'Maintenance statement', link: 'Maintenance-commands' }, ], }, ], diff --git a/src/.vuepress/sidebar/V2.0.x/zh-Tree.ts b/src/.vuepress/sidebar/V2.0.x/zh-Tree.ts index c4b3287d6..e4841e90c 100644 --- a/src/.vuepress/sidebar/V2.0.x/zh-Tree.ts +++ b/src/.vuepress/sidebar/V2.0.x/zh-Tree.ts @@ -109,7 +109,7 @@ export const zhSidebar = { children: [ { text: '查询性能分析', link: 'Query-Performance-Analysis' }, { text: '负载均衡', link: 'Load-Balance' }, - { text: '数据修复', link: 'Data-Recovery' }, + { text: '运维语句', link: 'Maintenance-statement' }, ], }, ], diff --git a/src/.vuepress/sidebar_timecho/V1.3.x/en.ts b/src/.vuepress/sidebar_timecho/V1.3.x/en.ts index 1f485ab38..6dbcbf4e8 100644 --- a/src/.vuepress/sidebar_timecho/V1.3.x/en.ts +++ b/src/.vuepress/sidebar_timecho/V1.3.x/en.ts @@ -144,7 +144,7 @@ export const enSidebar = { children: [ { text: 'Query Performance Analysis', link: 'Query-Performance-Analysis' }, { text: 'Load Balance', link: 'Load-Balance' }, - { text: 'Data Recovery', link: 'Data-Recovery' }, + { text: 'Maintenance statement', link: 'Maintenance-commands' }, ], }, ], diff --git a/src/.vuepress/sidebar_timecho/V1.3.x/zh.ts b/src/.vuepress/sidebar_timecho/V1.3.x/zh.ts index 95beddb0c..22278d122 100644 --- a/src/.vuepress/sidebar_timecho/V1.3.x/zh.ts +++ b/src/.vuepress/sidebar_timecho/V1.3.x/zh.ts @@ -127,7 +127,7 @@ export const zhSidebar = { children: [ { text: '查询性能分析', link: 'Query-Performance-Analysis' }, { text: '负载均衡', link: 'Load-Balance' }, - { text: '数据修复', link: 'Data-Recovery' }, + { text: '运维语句', link: 'Maintenance-statement' }, ], }, ], diff --git a/src/.vuepress/sidebar_timecho/V2.0.x/en-Tree.ts b/src/.vuepress/sidebar_timecho/V2.0.x/en-Tree.ts index f1590a6a6..823e947da 100644 --- a/src/.vuepress/sidebar_timecho/V2.0.x/en-Tree.ts +++ b/src/.vuepress/sidebar_timecho/V2.0.x/en-Tree.ts @@ -135,7 +135,7 @@ export const enSidebar = { children: [ { text: 'Query Performance Analysis', link: 'Query-Performance-Analysis' }, { text: 'Load Balance', link: 'Load-Balance' }, - { text: 'Data Recovery', link: 'Data-Recovery' }, + { text: 'Maintenance statement', link: 'Maintenance-commands' }, ], }, ], diff --git a/src/.vuepress/sidebar_timecho/V2.0.x/zh-Tree.ts b/src/.vuepress/sidebar_timecho/V2.0.x/zh-Tree.ts index 626b08993..62061d053 100644 --- a/src/.vuepress/sidebar_timecho/V2.0.x/zh-Tree.ts +++ b/src/.vuepress/sidebar_timecho/V2.0.x/zh-Tree.ts @@ -118,7 +118,7 @@ export const zhSidebar = { children: [ { text: '查询性能分析', link: 'Query-Performance-Analysis' }, { text: '负载均衡', link: 'Load-Balance' }, - { text: '数据修复', link: 'Data-Recovery' }, + { text: '运维语句', link: 'Maintenance-statement' }, ], }, ], diff --git a/src/UserGuide/Master/Table/User-Manual/Maintenance-commands.md b/src/UserGuide/Master/Table/User-Manual/Maintenance-commands.md index 75ee2f6d0..169b77973 100644 --- a/src/UserGuide/Master/Table/User-Manual/Maintenance-commands.md +++ b/src/UserGuide/Master/Table/User-Manual/Maintenance-commands.md @@ -22,7 +22,7 @@ ## 1. Status Checking -#### 1.1 Viewing the Connected Model +### 1.1 Viewing the Connected Model **Description**: Returns the current SQL dialect model (`Tree` or `Table`). @@ -50,7 +50,7 @@ IoTDB> SHOW CURRENT_SQL_DIALECT; +-----------------+ ``` -#### 1.2 Viewing the Logged-in Username +### 1.2 Viewing the Logged-in Username **Description**: Returns the currently logged-in username. @@ -78,7 +78,7 @@ IoTDB> SHOW CURRENT_USER; +-----------+ ``` -#### 1.3 Viewing the Connected Database Name +### 1.3 Viewing the Connected Database Name **Description**: Returns the name of the currently connected database. If no `USE` statement has been executed, it returns `null`. @@ -113,7 +113,7 @@ IoTDB> SHOW CURRENT_DATABASE; +---------------+ ``` -#### 1.4 Viewing the Cluster Version +### 1.4 Viewing the Cluster Version **Description**: Returns the current cluster version. @@ -141,7 +141,7 @@ IoTDB> SHOW VERSION; +-------+---------+ ``` -#### 1.5 Viewing Cluster Key Parameters +### 1.5 Viewing Cluster Key Parameters **Description**: Returns key parameters of the current cluster. @@ -201,7 +201,7 @@ IoTDB> SHOW VARIABLES; +----------------------------------+-----------------------------------------------------------------+ ``` -#### 1.6 Viewing the Cluster ID +### 1.6 Viewing the Cluster ID **Description**: Returns the ID of the current cluster. @@ -229,7 +229,7 @@ IoTDB> SHOW CLUSTER_ID; +------------------------------------+ ``` -#### 1.7 Viewing the Timestamp of the Connected DataNode +### 1.7 Viewing the Timestamp of the Connected DataNode **Description**: Returns the current timestamp of the DataNode process directly connected to the client. @@ -257,7 +257,7 @@ IoTDB> SHOW CURRENT_TIMESTAMP; +-----------------------------+ ``` -#### 1.8 Viewing Executing Queries +### 1.8 Viewing Executing Queries **Description**: Displays information about all currently executing queries. @@ -308,7 +308,7 @@ IoTDB> SHOW QUERIES WHERE elapsed_time > 30; ## 2. Status Setting -#### 2.1 Setting the Connected Model +### 2.1 Setting the Connected Model **Description**: Sets the current SQL dialect model to `Tree` or `Table` which can be used in both tree and table models. @@ -335,7 +335,7 @@ IoTDB> SHOW CURRENT_SQL_DIALECT; +-----------------+ ``` -#### 2.2 Updating Configuration Items +### 2.2 Updating Configuration Items **Description**: Updates configuration items. Changes take effect immediately without restarting if the items support hot modification. @@ -376,7 +376,7 @@ propertyValue IoTDB> SET CONFIGURATION "a"='1',b='1' ON 1; ``` -#### 2.3 Loading Manually Modified Configuration Files +### 2.3 Loading Manually Modified Configuration Files **Description**: Loads manually modified configuration files and hot-loads the changes. Configuration items that support hot modification take effect immediately. @@ -407,7 +407,7 @@ localOrClusterMode IoTDB> LOAD CONFIGURATION ON LOCAL; ``` -#### 2.4 Setting the System Status +### 2.4 Setting the System Status **Description**: Sets the system status to either `READONLY` or `RUNNING`. @@ -441,7 +441,7 @@ IoTDB> SET SYSTEM TO READONLY ON CLUSTER; ## 3. Data Management -#### 3.1 Flushing Data from Memory to Disk +### 3.1 Flushing Data from Memory to Disk **Description**: Flushes data from the memory table to disk. @@ -483,7 +483,7 @@ localOrClusterMode IoTDB> FLUSH test_db TRUE ON LOCAL; ``` -#### 3.2 Clearing Cache on DataNode +### 3.2 Clearing Cache on DataNode **Description**: Clears a specific type of cache on DataNode. @@ -526,7 +526,7 @@ IoTDB> CLEAR ALL CACHE ON LOCAL; ## 4. Data Repair -#### 4.1 Starting Background Scan and Repair of TsFiles +### 4.1 Starting Background Scan and Repair of TsFiles **Description**: Starts a background task to scan and repair TsFiles, fixing issues such as timestamp disorder within data files. @@ -555,7 +555,7 @@ localOrClusterMode IoTDB> START REPAIR DATA ON CLUSTER; ``` -#### 4.2 Pausing Background TsFile Repair Task +### 4.2 Pausing Background TsFile Repair Task **Description**: Pauses the background repair task. The paused task can be resumed by executing the `START REPAIR DATA` command again. @@ -586,7 +586,7 @@ IoTDB> STOP REPAIR DATA ON CLUSTER; ## 5. Query Termination -#### 5.1 Terminating Queries +### 5.1 Terminating Queries **Description**: Terminates one or more running queries. diff --git a/src/UserGuide/Master/Tree/User-Manual/Maintenance-commands.md b/src/UserGuide/Master/Tree/User-Manual/Maintenance-commands.md new file mode 100644 index 000000000..621c91d16 --- /dev/null +++ b/src/UserGuide/Master/Tree/User-Manual/Maintenance-commands.md @@ -0,0 +1,487 @@ + +# Maintenance Statement + +## 1. Status Checking + +### 1.1 Viewing the Connected Model + +**Description**: Returns the current SQL dialect model (`Tree` or `Table`). + +**Syntax**: + +```SQL +showCurrentSqlDialectStatement + : SHOW CURRENT_SQL_DIALECT + ; +``` + +**Example**: + +```SQL +IoTDB> SHOW CURRENT_SQL_DIALECT; +``` + +**Result:** + +```SQL ++-----------------+ +|CurrentSqlDialect| ++-----------------+ +| TREE| ++-----------------+ +``` + +### 1.2 Viewing the Cluster Version + +**Description**: Returns the current cluster version. + +**Syntax**: + +```SQL +showVersionStatement + : SHOW VERSION + ; +``` + +**Example**: + +```SQL +IoTDB> SHOW VERSION; +``` + +**Result**: + +```Plain ++-------+---------+ +|Version|BuildInfo| ++-------+---------+ +|2.0.1.2| 1ca4008| ++-------+---------+ +``` + +### 1.3 Viewing Cluster Key Parameters + +**Description**: Returns key parameters of the current cluster. + +**Syntax**: + +```SQL +showVariablesStatement + : SHOW VARIABLES + ; +``` + +Key Parameters: + +1. **ClusterName**: The name of the current cluster. +2. **DataReplicationFactor**: Number of data replicas per DataRegion. +3. **SchemaReplicationFactor**: Number of schema replicas per SchemaRegion. +4. **DataRegionConsensusProtocolClass**: Consensus protocol class for DataRegions. +5. **SchemaRegionConsensusProtocolClass**: Consensus protocol class for SchemaRegions. +6. **ConfigNodeConsensusProtocolClass**: Consensus protocol class for ConfigNodes. +7. **TimePartitionOrigin**: The starting timestamp of database time partitions. +8. **TimePartitionInterval**: The interval of database time partitions (in milliseconds). +9. **ReadConsistencyLevel**: The consistency level for read operations. +10. **SchemaRegionPerDataNode**: Number of SchemaRegions per DataNode. +11. **DataRegionPerDataNode**: Number of DataRegions per DataNode. +12. **SeriesSlotNum**: Number of SeriesSlots per DataRegion. +13. **SeriesSlotExecutorClass**: Implementation class for SeriesSlots. +14. **DiskSpaceWarningThreshold**: Disk space warning threshold (in percentage). +15. **TimestampPrecision**: Timestamp precision. + +**Example**: + +```SQL +IoTDB> SHOW VARIABLES; +``` + +**Result**: + +```Plain ++----------------------------------+-----------------------------------------------------------------+ +| Variable| Value| ++----------------------------------+-----------------------------------------------------------------+ +| ClusterName| defaultCluster| +| DataReplicationFactor| 1| +| SchemaReplicationFactor| 1| +| DataRegionConsensusProtocolClass| org.apache.iotdb.consensus.iot.IoTConsensus| +|SchemaRegionConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus| +| ConfigNodeConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus| +| TimePartitionOrigin| 0| +| TimePartitionInterval| 604800000| +| ReadConsistencyLevel| strong| +| SchemaRegionPerDataNode| 1| +| DataRegionPerDataNode| 0| +| SeriesSlotNum| 1000| +| SeriesSlotExecutorClass|org.apache.iotdb.commons.partition.executor.hash.BKDRHashExecutor| +| DiskSpaceWarningThreshold| 0.05| +| TimestampPrecision| ms| ++----------------------------------+-----------------------------------------------------------------+ +``` + +### 1.4 Viewing the Current Timestamp of Database + +**Description**: Returns the current timestamp of the database. + +**Syntax**: + +```SQL +showCurrentTimestampStatement + : SHOW CURRENT_TIMESTAMP + ; +``` + +**Example**: + +```SQL +IoTDB> SHOW CURRENT_TIMESTAMP; +``` + +**Result**: + +```Plain ++-----------------------------+ +| CurrentTimestamp| ++-----------------------------+ +|2025-02-17T11:11:52.987+08:00| ++-----------------------------+ +``` + +### 1.5 Viewing Executing Queries + +**Description**: Displays information about all currently executing queries. + +**Syntax**: + +```SQL +showQueriesStatement + : SHOW (QUERIES | QUERY PROCESSLIST) + (WHERE where=booleanExpression)? + (ORDER BY sortItem (',' sortItem)*)? + limitOffsetClause + ; +``` + +**Parameters**: + +1. **WHERE Clause**: Filters the result set based on specified conditions. +2. **ORDER BY Clause**: Sorts the result set based on specified columns. +3. **limitOffsetClause**: Limits the number of rows returned. + 1. Format: `LIMIT , `. + +**Columns in QUERIES Table**: + +- **time**: Timestamp when the query started. +- **queryid**: Unique ID of the query. +- **datanodeid**: ID of the DataNode executing the query. +- **elapsedtime**: Time elapsed since the query started (in seconds). +- **statement**: The SQL statement being executed. + +**Example**: + +```SQL +IoTDB> SHOW QUERIES WHERE elapsedtime > 0.003 +``` + +**Result**: + +```SQL ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +| Time| QueryId|DataNodeId|ElapsedTime| Statement| ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +|2025-05-09T15:16:01.293+08:00|20250509_071601_00015_1| 1| 0.006|SHOW QUERIES WHERE elapsedtime > 0.003| ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +``` + + +## 2. Status Setting + +### 2.1 Setting the Connected Model + +**Description**: Sets the current SQL dialect model to `Tree` or `Table` which can be used in both tree and table models. + +**Syntax**: + +```SQL +SET SQL_DIALECT = (TABLE | TREE); +``` + +**Example**: + +```SQL +IoTDB> SET SQL_DIALECT=TREE; +IoTDB> SHOW CURRENT_SQL_DIALECT; +``` + +**Result**: + +```SQL ++-----------------+ +|CurrentSqlDialect| ++-----------------+ +| TREE| ++-----------------+ +``` + +### 2.2 Updating Configuration Items + +**Description**: Updates configuration items. Changes take effect immediately without restarting if the items support hot modification. + +**Syntax**: + +```SQL +setConfigurationStatement + : SET CONFIGURATION propertyAssignments (ON INTEGER_VALUE)? + ; + +propertyAssignments + : property (',' property)* + ; + +property + : identifier EQ propertyValue + ; + +propertyValue + : DEFAULT + | expression + ; +``` + +**Parameters**: + +1. **propertyAssignments**: A list of properties to update. + 1. Format: `property (',' property)*`. + 2. Values: + - `DEFAULT`: Resets the configuration to its default value. + - `expression`: A specific value (must be a string). +2. **ON INTEGER_VALUE** **(Optional):** Specifies the node ID to update. + 1. If not specified or set to a negative value, updates all ConfigNodes and DataNodes. + +**Example**: + +```SQL +IoTDB> SET CONFIGURATION "a"='1',b='1' ON 1; +``` + +### 2.3 Loading Manually Modified Configuration Files + +**Description**: Loads manually modified configuration files and hot-loads the changes. Configuration items that support hot modification take effect immediately. + +**Syntax**: + +```SQL +loadConfigurationStatement + : LOAD CONFIGURATION localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **localOrClusterMode** **(Optional):** + 1. Specifies the scope of configuration loading. + 2. Default: `CLUSTER`. + 3. Values: + - `LOCAL`: Loads configuration only on the DataNode directly connected to the client. + - `CLUSTER`: Loads configuration on all DataNodes in the cluster. + +**Example**: + +```SQL +IoTDB> LOAD CONFIGURATION ON LOCAL; +``` + +### 2.4 Setting the System Status + +**Description**: Sets the system status to either `READONLY` or `RUNNING`. + +**Syntax**: + +```SQL +setSystemStatusStatement + : SET SYSTEM TO (READONLY | RUNNING) localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **RUNNING |** **READONLY**: + 1. **RUNNING**: Sets the system to running mode, allowing both read and write operations. + 2. **READONLY**: Sets the system to read-only mode, allowing only read operations and prohibiting writes. +2. **localOrClusterMode** **(Optional):** + 1. **LOCAL**: Applies the status change only to the DataNode directly connected to the client. + 2. **CLUSTER**: Applies the status change to all DataNodes in the cluster. + 3. **Default**: `ON CLUSTER`. + +**Example**: + +```SQL +IoTDB> SET SYSTEM TO READONLY ON CLUSTER; +``` + +## 3. Data Management + +### 3.1 Flushing Data from Memory to Disk + +**Description**: Flushes data from the memory table to disk. + +**Syntax**: + +```SQL +flushStatement + : FLUSH identifier? (',' identifier)* booleanValue? localOrClusterMode? + ; + +booleanValue + : TRUE | FALSE + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **identifier** **(Optional):** + 1. Specifies the name of the path to flush. + 2. If not specified, all paths are flushed. + 3. **Multiple Paths**: Multiple path names can be specified, separated by commas (e.g., `FLUSH root.ln, root.lnm.**`). +2. **booleanValue** **(****Optional****)**: + 1. Specifies the type of data to flush. + 2. **TRUE**: Flushes only the sequential memory table. + 3. **FALSE**: Flushes only the unsequential MemTable. + 4. **Default**: Flushes both sequential and unsequential memory tables. +3. **localOrClusterMode** **(****Optional****)**: + 1. **ON LOCAL**: Flushes only the memory tables on the DataNode directly connected to the client. + 2. **ON CLUSTER**: Flushes memory tables on all DataNodes in the cluster. + 3. **Default:** `ON CLUSTER`. + +**Example**: + +```SQL +IoTDB> FLUSH root.ln TRUE ON LOCAL; +``` + +## 4. Data Repair + +### 4.1 Starting Background Scan and Repair of TsFiles + +**Description**: Starts a background task to scan and repair TsFiles, fixing issues such as timestamp disorder within data files. + +**Syntax**: + +```SQL +startRepairDataStatement + : START REPAIR DATA localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **localOrClusterMode(Optional)**: + 1. **ON LOCAL**: Executes the repair task only on the DataNode directly connected to the client. + 2. **ON CLUSTER**: Executes the repair task on all DataNodes in the cluster. + 3. **Default:** `ON CLUSTER`. + +**Example**: + +```SQL +IoTDB> START REPAIR DATA ON CLUSTER; +``` + +### 4.2 Pausing Background TsFile Repair Task + +**Description**: Pauses the background repair task. The paused task can be resumed by executing the `START REPAIR DATA` command again. + +**Syntax**: + +```SQL +stopRepairDataStatement + : STOP REPAIR DATA localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **localOrClusterMode** **(Optional):** + 1. **ON LOCAL**: Executes the pause command only on the DataNode directly connected to the client. + 2. **ON CLUSTER**: Executes the pause command on all DataNodes in the cluster. + 3. **Default:** `ON CLUSTER`. + +**Example**: + +```SQL +IoTDB> STOP REPAIR DATA ON CLUSTER; +``` + +## 5. Query Termination + +### 5.1 Terminating Queries + +**Description**: Terminates one or more running queries. + +**Syntax**: + +```SQL +killQueryStatement + : KILL (QUERY queryId=string | ALL QUERIES) + ; +``` + +**Parameters**: + +1. **QUERY** **queryId:** Specifies the ID of the query to terminate. + +- To obtain the `queryId`, use the `SHOW QUERIES` command. + +2. **ALL QUERIES:** Terminates all currently running queries. + +**Example**: + +Terminate a specific query: + +```SQL +IoTDB> KILL QUERY 20250108_101015_00000_1; +``` + +Terminate all queries: + +```SQL +IoTDB> KILL ALL QUERIES; +``` \ No newline at end of file diff --git a/src/UserGuide/V1.3.x/User-Manual/Maintenance-commands.md b/src/UserGuide/V1.3.x/User-Manual/Maintenance-commands.md new file mode 100644 index 000000000..0fe1c2d65 --- /dev/null +++ b/src/UserGuide/V1.3.x/User-Manual/Maintenance-commands.md @@ -0,0 +1,432 @@ + +# Maintenance Statement + +## 1. Status Checking + +### 1.1 Viewing the Cluster Version + +**Description**: Returns the current cluster version. + +**Syntax**: + +```SQL +showVersionStatement + : SHOW VERSION + ; +``` + +**Example**: + +```SQL +IoTDB> SHOW VERSION; +``` + +**Result**: + +```Plain ++-------+-----------+ +|Version| BuildInfo| ++-------+-----------+ +|1.3.4.1|e5334cf-dev| ++-------+-----------+ +``` + +### 1.2 Viewing Cluster Key Parameters + +**Description**: Returns key parameters of the current cluster. + +**Syntax**: + +```SQL +showVariablesStatement + : SHOW VARIABLES + ; +``` + +Key Parameters: + +1. **ClusterName**: The name of the current cluster. +2. **DataReplicationFactor**: Number of data replicas per DataRegion. +3. **SchemaReplicationFactor**: Number of schema replicas per SchemaRegion. +4. **DataRegionConsensusProtocolClass**: Consensus protocol class for DataRegions. +5. **SchemaRegionConsensusProtocolClass**: Consensus protocol class for SchemaRegions. +6. **ConfigNodeConsensusProtocolClass**: Consensus protocol class for ConfigNodes. +7. **TimePartitionOrigin**: The starting timestamp of database time partitions. +8. **TimePartitionInterval**: The interval of database time partitions (in milliseconds). +9. **ReadConsistencyLevel**: The consistency level for read operations. +10. **SchemaRegionPerDataNode**: Number of SchemaRegions per DataNode. +11. **DataRegionPerDataNode**: Number of DataRegions per DataNode. +12. **SeriesSlotNum**: Number of SeriesSlots per DataRegion. +13. **SeriesSlotExecutorClass**: Implementation class for SeriesSlots. +14. **DiskSpaceWarningThreshold**: Disk space warning threshold (in percentage). +15. **TimestampPrecision**: Timestamp precision. + +**Example**: + +```SQL +IoTDB> SHOW VARIABLES; +``` + +**Result**: + +```Plain ++----------------------------------+-----------------------------------------------------------------+ +| Variable| Value| ++----------------------------------+-----------------------------------------------------------------+ +| ClusterName| defaultCluster| +| DataReplicationFactor| 1| +| SchemaReplicationFactor| 1| +| DataRegionConsensusProtocolClass| org.apache.iotdb.consensus.iot.IoTConsensus| +|SchemaRegionConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus| +| ConfigNodeConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus| +| TimePartitionOrigin| 0| +| TimePartitionInterval| 604800000| +| ReadConsistencyLevel| strong| +| SchemaRegionPerDataNode| 1| +| DataRegionPerDataNode| 0| +| SeriesSlotNum| 1000| +| SeriesSlotExecutorClass|org.apache.iotdb.commons.partition.executor.hash.BKDRHashExecutor| +| DiskSpaceWarningThreshold| 0.05| +| TimestampPrecision| ms| ++----------------------------------+-----------------------------------------------------------------+ +``` + +### 1.3 Viewing the Current Timestamp of Database + +**Description**: Returns the current timestamp of the database. + +**Syntax**: + +```SQL +showCurrentTimestampStatement + : SHOW CURRENT_TIMESTAMP + ; +``` + +**Example**: + +```SQL +IoTDB> SHOW CURRENT_TIMESTAMP; +``` + +**Result**: + +```Plain ++-----------------------------+ +| CurrentTimestamp| ++-----------------------------+ +|2025-02-17T11:11:52.987+08:00| ++-----------------------------+ +``` + +### 1.4 Viewing Executing Queries + +**Description**: Displays information about all currently executing queries. + +**Syntax**: + +```SQL +showQueriesStatement + : SHOW (QUERIES | QUERY PROCESSLIST) + (WHERE where=booleanExpression)? + (ORDER BY sortItem (',' sortItem)*)? + limitOffsetClause + ; +``` + +**Parameters**: + +1. **WHERE Clause**: Filters the result set based on specified conditions. +2. **ORDER BY Clause**: Sorts the result set based on specified columns. +3. **limitOffsetClause**: Limits the number of rows returned. + 1. Format: `LIMIT , `. + +**Columns in QUERIES Table**: + +- **time**: Timestamp when the query started. +- **queryid**: Unique ID of the query. +- **datanodeid**: ID of the DataNode executing the query. +- **elapsedtime**: Time elapsed since the query started (in seconds). +- **statement**: The SQL statement being executed. + +**Example**: + +```SQL +IoTDB> SHOW QUERIES WHERE elapsedtime > 0.003 +``` + +**Result**: + +```SQL ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +| Time| QueryId|DataNodeId|ElapsedTime| Statement| ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +|2025-05-09T15:16:01.293+08:00|20250509_071601_00015_1| 1| 0.006|SHOW QUERIES WHERE elapsedtime > 0.003| ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +``` + + +## 2. Status Setting + +### 2.1 Updating Configuration Items + +**Description**: Updates configuration items. Changes take effect immediately without restarting if the items support hot modification. + +**Syntax**: + +```SQL +setConfigurationStatement + : SET CONFIGURATION propertyAssignments (ON INTEGER_VALUE)? + ; + +propertyAssignments + : property (',' property)* + ; + +property + : identifier EQ propertyValue + ; + +propertyValue + : DEFAULT + | expression + ; +``` + +**Parameters**: + +1. **propertyAssignments**: A list of properties to update. + 1. Format: `property (',' property)*`. + 2. Values: + - `DEFAULT`: Resets the configuration to its default value. + - `expression`: A specific value (must be a string). +2. **ON INTEGER_VALUE** **(Optional):** Specifies the node ID to update. + 1. If not specified or set to a negative value, updates all ConfigNodes and DataNodes. + +**Example**: + +```SQL +IoTDB> SET CONFIGURATION "a"='1',b='1' ON 1; +``` + +### 2.2 Loading Manually Modified Configuration Files + +**Description**: Loads manually modified configuration files and hot-loads the changes. Configuration items that support hot modification take effect immediately. + +**Syntax**: + +```SQL +loadConfigurationStatement + : LOAD CONFIGURATION localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **localOrClusterMode** **(Optional):** + 1. Specifies the scope of configuration loading. + 2. Default: `CLUSTER`. + 3. Values: + - `LOCAL`: Loads configuration only on the DataNode directly connected to the client. + - `CLUSTER`: Loads configuration on all DataNodes in the cluster. + +**Example**: + +```SQL +IoTDB> LOAD CONFIGURATION ON LOCAL; +``` + +### 2.3 Setting the System Status + +**Description**: Sets the system status to either `READONLY` or `RUNNING`. + +**Syntax**: + +```SQL +setSystemStatusStatement + : SET SYSTEM TO (READONLY | RUNNING) localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **RUNNING |** **READONLY**: + 1. **RUNNING**: Sets the system to running mode, allowing both read and write operations. + 2. **READONLY**: Sets the system to read-only mode, allowing only read operations and prohibiting writes. +2. **localOrClusterMode** **(Optional):** + 1. **LOCAL**: Applies the status change only to the DataNode directly connected to the client. + 2. **CLUSTER**: Applies the status change to all DataNodes in the cluster. + 3. **Default**: `ON CLUSTER`. + +**Example**: + +```SQL +IoTDB> SET SYSTEM TO READONLY ON CLUSTER; +``` + +## 3. Data Management + +### 3.1 Flushing Data from Memory to Disk + +**Description**: Flushes data from the memory table to disk. + +**Syntax**: + +```SQL +flushStatement + : FLUSH identifier? (',' identifier)* booleanValue? localOrClusterMode? + ; + +booleanValue + : TRUE | FALSE + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **identifier** **(Optional):** + 1. Specifies the name of the path to flush. + 2. If not specified, all path are flushed. + 3. **Multiple Paths**: Multiple path names can be specified, separated by commas (e.g., `FLUSH root.ln, root.lnm.**`). +2. **booleanValue** **(****Optional****)**: + 1. Specifies the type of data to flush. + 2. **TRUE**: Flushes only the sequential memory table. + 3. **FALSE**: Flushes only the unsequential MemTable. + 4. **Default**: Flushes both sequential and unsequential memory tables. +3. **localOrClusterMode** **(****Optional****)**: + 1. **ON LOCAL**: Flushes only the memory tables on the DataNode directly connected to the client. + 2. **ON CLUSTER**: Flushes memory tables on all DataNodes in the cluster. + 3. **Default:** `ON CLUSTER`. + +**Example**: + +```SQL +IoTDB> FLUSH root.ln TRUE ON LOCAL; +``` + +## 4. Data Repair + +### 4.1 Starting Background Scan and Repair of TsFiles + +**Description**: Starts a background task to scan and repair TsFiles, fixing issues such as timestamp disorder within data files. + +**Syntax**: + +```SQL +startRepairDataStatement + : START REPAIR DATA localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **localOrClusterMode(Optional)**: + 1. **ON LOCAL**: Executes the repair task only on the DataNode directly connected to the client. + 2. **ON CLUSTER**: Executes the repair task on all DataNodes in the cluster. + 3. **Default:** `ON CLUSTER`. + +**Example**: + +```SQL +IoTDB> START REPAIR DATA ON CLUSTER; +``` + +### 4.2 Pausing Background TsFile Repair Task + +**Description**: Pauses the background repair task. The paused task can be resumed by executing the `START REPAIR DATA` command again. + +**Syntax**: + +```SQL +stopRepairDataStatement + : STOP REPAIR DATA localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **localOrClusterMode** **(Optional):** + 1. **ON LOCAL**: Executes the pause command only on the DataNode directly connected to the client. + 2. **ON CLUSTER**: Executes the pause command on all DataNodes in the cluster. + 3. **Default:** `ON CLUSTER`. + +**Example**: + +```SQL +IoTDB> STOP REPAIR DATA ON CLUSTER; +``` + +## 5. Query Termination + +### 5.1 Terminating Queries + +**Description**: Terminates one or more running queries. + +**Syntax**: + +```SQL +killQueryStatement + : KILL (QUERY queryId=string | ALL QUERIES) + ; +``` + +**Parameters**: + +1. **QUERY** **queryId:** Specifies the ID of the query to terminate. + +- To obtain the `queryId`, use the `SHOW QUERIES` command. + +2. **ALL QUERIES:** Terminates all currently running queries. + +**Example**: + +Terminate a specific query: + +```SQL +IoTDB> KILL QUERY 20250108_101015_00000_1; +``` + +Terminate all queries: + +```SQL +IoTDB> KILL ALL QUERIES; +``` \ No newline at end of file diff --git a/src/UserGuide/dev-1.3/User-Manual/Maintenance-commands.md b/src/UserGuide/dev-1.3/User-Manual/Maintenance-commands.md new file mode 100644 index 000000000..0fe1c2d65 --- /dev/null +++ b/src/UserGuide/dev-1.3/User-Manual/Maintenance-commands.md @@ -0,0 +1,432 @@ + +# Maintenance Statement + +## 1. Status Checking + +### 1.1 Viewing the Cluster Version + +**Description**: Returns the current cluster version. + +**Syntax**: + +```SQL +showVersionStatement + : SHOW VERSION + ; +``` + +**Example**: + +```SQL +IoTDB> SHOW VERSION; +``` + +**Result**: + +```Plain ++-------+-----------+ +|Version| BuildInfo| ++-------+-----------+ +|1.3.4.1|e5334cf-dev| ++-------+-----------+ +``` + +### 1.2 Viewing Cluster Key Parameters + +**Description**: Returns key parameters of the current cluster. + +**Syntax**: + +```SQL +showVariablesStatement + : SHOW VARIABLES + ; +``` + +Key Parameters: + +1. **ClusterName**: The name of the current cluster. +2. **DataReplicationFactor**: Number of data replicas per DataRegion. +3. **SchemaReplicationFactor**: Number of schema replicas per SchemaRegion. +4. **DataRegionConsensusProtocolClass**: Consensus protocol class for DataRegions. +5. **SchemaRegionConsensusProtocolClass**: Consensus protocol class for SchemaRegions. +6. **ConfigNodeConsensusProtocolClass**: Consensus protocol class for ConfigNodes. +7. **TimePartitionOrigin**: The starting timestamp of database time partitions. +8. **TimePartitionInterval**: The interval of database time partitions (in milliseconds). +9. **ReadConsistencyLevel**: The consistency level for read operations. +10. **SchemaRegionPerDataNode**: Number of SchemaRegions per DataNode. +11. **DataRegionPerDataNode**: Number of DataRegions per DataNode. +12. **SeriesSlotNum**: Number of SeriesSlots per DataRegion. +13. **SeriesSlotExecutorClass**: Implementation class for SeriesSlots. +14. **DiskSpaceWarningThreshold**: Disk space warning threshold (in percentage). +15. **TimestampPrecision**: Timestamp precision. + +**Example**: + +```SQL +IoTDB> SHOW VARIABLES; +``` + +**Result**: + +```Plain ++----------------------------------+-----------------------------------------------------------------+ +| Variable| Value| ++----------------------------------+-----------------------------------------------------------------+ +| ClusterName| defaultCluster| +| DataReplicationFactor| 1| +| SchemaReplicationFactor| 1| +| DataRegionConsensusProtocolClass| org.apache.iotdb.consensus.iot.IoTConsensus| +|SchemaRegionConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus| +| ConfigNodeConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus| +| TimePartitionOrigin| 0| +| TimePartitionInterval| 604800000| +| ReadConsistencyLevel| strong| +| SchemaRegionPerDataNode| 1| +| DataRegionPerDataNode| 0| +| SeriesSlotNum| 1000| +| SeriesSlotExecutorClass|org.apache.iotdb.commons.partition.executor.hash.BKDRHashExecutor| +| DiskSpaceWarningThreshold| 0.05| +| TimestampPrecision| ms| ++----------------------------------+-----------------------------------------------------------------+ +``` + +### 1.3 Viewing the Current Timestamp of Database + +**Description**: Returns the current timestamp of the database. + +**Syntax**: + +```SQL +showCurrentTimestampStatement + : SHOW CURRENT_TIMESTAMP + ; +``` + +**Example**: + +```SQL +IoTDB> SHOW CURRENT_TIMESTAMP; +``` + +**Result**: + +```Plain ++-----------------------------+ +| CurrentTimestamp| ++-----------------------------+ +|2025-02-17T11:11:52.987+08:00| ++-----------------------------+ +``` + +### 1.4 Viewing Executing Queries + +**Description**: Displays information about all currently executing queries. + +**Syntax**: + +```SQL +showQueriesStatement + : SHOW (QUERIES | QUERY PROCESSLIST) + (WHERE where=booleanExpression)? + (ORDER BY sortItem (',' sortItem)*)? + limitOffsetClause + ; +``` + +**Parameters**: + +1. **WHERE Clause**: Filters the result set based on specified conditions. +2. **ORDER BY Clause**: Sorts the result set based on specified columns. +3. **limitOffsetClause**: Limits the number of rows returned. + 1. Format: `LIMIT , `. + +**Columns in QUERIES Table**: + +- **time**: Timestamp when the query started. +- **queryid**: Unique ID of the query. +- **datanodeid**: ID of the DataNode executing the query. +- **elapsedtime**: Time elapsed since the query started (in seconds). +- **statement**: The SQL statement being executed. + +**Example**: + +```SQL +IoTDB> SHOW QUERIES WHERE elapsedtime > 0.003 +``` + +**Result**: + +```SQL ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +| Time| QueryId|DataNodeId|ElapsedTime| Statement| ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +|2025-05-09T15:16:01.293+08:00|20250509_071601_00015_1| 1| 0.006|SHOW QUERIES WHERE elapsedtime > 0.003| ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +``` + + +## 2. Status Setting + +### 2.1 Updating Configuration Items + +**Description**: Updates configuration items. Changes take effect immediately without restarting if the items support hot modification. + +**Syntax**: + +```SQL +setConfigurationStatement + : SET CONFIGURATION propertyAssignments (ON INTEGER_VALUE)? + ; + +propertyAssignments + : property (',' property)* + ; + +property + : identifier EQ propertyValue + ; + +propertyValue + : DEFAULT + | expression + ; +``` + +**Parameters**: + +1. **propertyAssignments**: A list of properties to update. + 1. Format: `property (',' property)*`. + 2. Values: + - `DEFAULT`: Resets the configuration to its default value. + - `expression`: A specific value (must be a string). +2. **ON INTEGER_VALUE** **(Optional):** Specifies the node ID to update. + 1. If not specified or set to a negative value, updates all ConfigNodes and DataNodes. + +**Example**: + +```SQL +IoTDB> SET CONFIGURATION "a"='1',b='1' ON 1; +``` + +### 2.2 Loading Manually Modified Configuration Files + +**Description**: Loads manually modified configuration files and hot-loads the changes. Configuration items that support hot modification take effect immediately. + +**Syntax**: + +```SQL +loadConfigurationStatement + : LOAD CONFIGURATION localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **localOrClusterMode** **(Optional):** + 1. Specifies the scope of configuration loading. + 2. Default: `CLUSTER`. + 3. Values: + - `LOCAL`: Loads configuration only on the DataNode directly connected to the client. + - `CLUSTER`: Loads configuration on all DataNodes in the cluster. + +**Example**: + +```SQL +IoTDB> LOAD CONFIGURATION ON LOCAL; +``` + +### 2.3 Setting the System Status + +**Description**: Sets the system status to either `READONLY` or `RUNNING`. + +**Syntax**: + +```SQL +setSystemStatusStatement + : SET SYSTEM TO (READONLY | RUNNING) localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **RUNNING |** **READONLY**: + 1. **RUNNING**: Sets the system to running mode, allowing both read and write operations. + 2. **READONLY**: Sets the system to read-only mode, allowing only read operations and prohibiting writes. +2. **localOrClusterMode** **(Optional):** + 1. **LOCAL**: Applies the status change only to the DataNode directly connected to the client. + 2. **CLUSTER**: Applies the status change to all DataNodes in the cluster. + 3. **Default**: `ON CLUSTER`. + +**Example**: + +```SQL +IoTDB> SET SYSTEM TO READONLY ON CLUSTER; +``` + +## 3. Data Management + +### 3.1 Flushing Data from Memory to Disk + +**Description**: Flushes data from the memory table to disk. + +**Syntax**: + +```SQL +flushStatement + : FLUSH identifier? (',' identifier)* booleanValue? localOrClusterMode? + ; + +booleanValue + : TRUE | FALSE + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **identifier** **(Optional):** + 1. Specifies the name of the path to flush. + 2. If not specified, all path are flushed. + 3. **Multiple Paths**: Multiple path names can be specified, separated by commas (e.g., `FLUSH root.ln, root.lnm.**`). +2. **booleanValue** **(****Optional****)**: + 1. Specifies the type of data to flush. + 2. **TRUE**: Flushes only the sequential memory table. + 3. **FALSE**: Flushes only the unsequential MemTable. + 4. **Default**: Flushes both sequential and unsequential memory tables. +3. **localOrClusterMode** **(****Optional****)**: + 1. **ON LOCAL**: Flushes only the memory tables on the DataNode directly connected to the client. + 2. **ON CLUSTER**: Flushes memory tables on all DataNodes in the cluster. + 3. **Default:** `ON CLUSTER`. + +**Example**: + +```SQL +IoTDB> FLUSH root.ln TRUE ON LOCAL; +``` + +## 4. Data Repair + +### 4.1 Starting Background Scan and Repair of TsFiles + +**Description**: Starts a background task to scan and repair TsFiles, fixing issues such as timestamp disorder within data files. + +**Syntax**: + +```SQL +startRepairDataStatement + : START REPAIR DATA localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **localOrClusterMode(Optional)**: + 1. **ON LOCAL**: Executes the repair task only on the DataNode directly connected to the client. + 2. **ON CLUSTER**: Executes the repair task on all DataNodes in the cluster. + 3. **Default:** `ON CLUSTER`. + +**Example**: + +```SQL +IoTDB> START REPAIR DATA ON CLUSTER; +``` + +### 4.2 Pausing Background TsFile Repair Task + +**Description**: Pauses the background repair task. The paused task can be resumed by executing the `START REPAIR DATA` command again. + +**Syntax**: + +```SQL +stopRepairDataStatement + : STOP REPAIR DATA localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **localOrClusterMode** **(Optional):** + 1. **ON LOCAL**: Executes the pause command only on the DataNode directly connected to the client. + 2. **ON CLUSTER**: Executes the pause command on all DataNodes in the cluster. + 3. **Default:** `ON CLUSTER`. + +**Example**: + +```SQL +IoTDB> STOP REPAIR DATA ON CLUSTER; +``` + +## 5. Query Termination + +### 5.1 Terminating Queries + +**Description**: Terminates one or more running queries. + +**Syntax**: + +```SQL +killQueryStatement + : KILL (QUERY queryId=string | ALL QUERIES) + ; +``` + +**Parameters**: + +1. **QUERY** **queryId:** Specifies the ID of the query to terminate. + +- To obtain the `queryId`, use the `SHOW QUERIES` command. + +2. **ALL QUERIES:** Terminates all currently running queries. + +**Example**: + +Terminate a specific query: + +```SQL +IoTDB> KILL QUERY 20250108_101015_00000_1; +``` + +Terminate all queries: + +```SQL +IoTDB> KILL ALL QUERIES; +``` \ No newline at end of file diff --git a/src/UserGuide/latest-Table/User-Manual/Maintenance-commands.md b/src/UserGuide/latest-Table/User-Manual/Maintenance-commands.md index 75ee2f6d0..31c737f4b 100644 --- a/src/UserGuide/latest-Table/User-Manual/Maintenance-commands.md +++ b/src/UserGuide/latest-Table/User-Manual/Maintenance-commands.md @@ -22,7 +22,7 @@ ## 1. Status Checking -#### 1.1 Viewing the Connected Model +### 1.1 Viewing the Connected Model **Description**: Returns the current SQL dialect model (`Tree` or `Table`). @@ -50,7 +50,7 @@ IoTDB> SHOW CURRENT_SQL_DIALECT; +-----------------+ ``` -#### 1.2 Viewing the Logged-in Username +### 1.2 Viewing the Logged-in Username **Description**: Returns the currently logged-in username. @@ -78,7 +78,7 @@ IoTDB> SHOW CURRENT_USER; +-----------+ ``` -#### 1.3 Viewing the Connected Database Name +### 1.3 Viewing the Connected Database Name **Description**: Returns the name of the currently connected database. If no `USE` statement has been executed, it returns `null`. @@ -113,7 +113,7 @@ IoTDB> SHOW CURRENT_DATABASE; +---------------+ ``` -#### 1.4 Viewing the Cluster Version +### 1.4 Viewing the Cluster Version **Description**: Returns the current cluster version. @@ -141,7 +141,7 @@ IoTDB> SHOW VERSION; +-------+---------+ ``` -#### 1.5 Viewing Cluster Key Parameters +### 1.5 Viewing Cluster Key Parameters **Description**: Returns key parameters of the current cluster. @@ -201,7 +201,7 @@ IoTDB> SHOW VARIABLES; +----------------------------------+-----------------------------------------------------------------+ ``` -#### 1.6 Viewing the Cluster ID +### 1.6 Viewing the Cluster ID **Description**: Returns the ID of the current cluster. @@ -229,7 +229,7 @@ IoTDB> SHOW CLUSTER_ID; +------------------------------------+ ``` -#### 1.7 Viewing the Timestamp of the Connected DataNode +### 1.7 Viewing the Timestamp of the Connected DataNode **Description**: Returns the current timestamp of the DataNode process directly connected to the client. @@ -257,7 +257,7 @@ IoTDB> SHOW CURRENT_TIMESTAMP; +-----------------------------+ ``` -#### 1.8 Viewing Executing Queries +### 1.8 Viewing Executing Queries **Description**: Displays information about all currently executing queries. @@ -306,9 +306,10 @@ IoTDB> SHOW QUERIES WHERE elapsed_time > 30; +-----------------------+-----------------------------+-----------+------------+------------+----+ ``` + ## 2. Status Setting -#### 2.1 Setting the Connected Model +### 2.1 Setting the Connected Model **Description**: Sets the current SQL dialect model to `Tree` or `Table` which can be used in both tree and table models. @@ -335,7 +336,7 @@ IoTDB> SHOW CURRENT_SQL_DIALECT; +-----------------+ ``` -#### 2.2 Updating Configuration Items +### 2.2 Updating Configuration Items **Description**: Updates configuration items. Changes take effect immediately without restarting if the items support hot modification. @@ -376,7 +377,7 @@ propertyValue IoTDB> SET CONFIGURATION "a"='1',b='1' ON 1; ``` -#### 2.3 Loading Manually Modified Configuration Files +### 2.3 Loading Manually Modified Configuration Files **Description**: Loads manually modified configuration files and hot-loads the changes. Configuration items that support hot modification take effect immediately. @@ -407,7 +408,7 @@ localOrClusterMode IoTDB> LOAD CONFIGURATION ON LOCAL; ``` -#### 2.4 Setting the System Status +### 2.4 Setting the System Status **Description**: Sets the system status to either `READONLY` or `RUNNING`. @@ -441,7 +442,7 @@ IoTDB> SET SYSTEM TO READONLY ON CLUSTER; ## 3. Data Management -#### 3.1 Flushing Data from Memory to Disk +### 3.1 Flushing Data from Memory to Disk **Description**: Flushes data from the memory table to disk. @@ -483,7 +484,7 @@ localOrClusterMode IoTDB> FLUSH test_db TRUE ON LOCAL; ``` -#### 3.2 Clearing Cache on DataNode +### 3.2 Clearing Cache on DataNode **Description**: Clears a specific type of cache on DataNode. @@ -526,7 +527,7 @@ IoTDB> CLEAR ALL CACHE ON LOCAL; ## 4. Data Repair -#### 4.1 Starting Background Scan and Repair of TsFiles +### 4.1 Starting Background Scan and Repair of TsFiles **Description**: Starts a background task to scan and repair TsFiles, fixing issues such as timestamp disorder within data files. @@ -555,7 +556,7 @@ localOrClusterMode IoTDB> START REPAIR DATA ON CLUSTER; ``` -#### 4.2 Pausing Background TsFile Repair Task +### 4.2 Pausing Background TsFile Repair Task **Description**: Pauses the background repair task. The paused task can be resumed by executing the `START REPAIR DATA` command again. @@ -586,7 +587,7 @@ IoTDB> STOP REPAIR DATA ON CLUSTER; ## 5. Query Termination -#### 5.1 Terminating Queries +### 5.1 Terminating Queries **Description**: Terminates one or more running queries. diff --git a/src/UserGuide/latest/User-Manual/Maintenance-commands.md b/src/UserGuide/latest/User-Manual/Maintenance-commands.md new file mode 100644 index 000000000..621c91d16 --- /dev/null +++ b/src/UserGuide/latest/User-Manual/Maintenance-commands.md @@ -0,0 +1,487 @@ + +# Maintenance Statement + +## 1. Status Checking + +### 1.1 Viewing the Connected Model + +**Description**: Returns the current SQL dialect model (`Tree` or `Table`). + +**Syntax**: + +```SQL +showCurrentSqlDialectStatement + : SHOW CURRENT_SQL_DIALECT + ; +``` + +**Example**: + +```SQL +IoTDB> SHOW CURRENT_SQL_DIALECT; +``` + +**Result:** + +```SQL ++-----------------+ +|CurrentSqlDialect| ++-----------------+ +| TREE| ++-----------------+ +``` + +### 1.2 Viewing the Cluster Version + +**Description**: Returns the current cluster version. + +**Syntax**: + +```SQL +showVersionStatement + : SHOW VERSION + ; +``` + +**Example**: + +```SQL +IoTDB> SHOW VERSION; +``` + +**Result**: + +```Plain ++-------+---------+ +|Version|BuildInfo| ++-------+---------+ +|2.0.1.2| 1ca4008| ++-------+---------+ +``` + +### 1.3 Viewing Cluster Key Parameters + +**Description**: Returns key parameters of the current cluster. + +**Syntax**: + +```SQL +showVariablesStatement + : SHOW VARIABLES + ; +``` + +Key Parameters: + +1. **ClusterName**: The name of the current cluster. +2. **DataReplicationFactor**: Number of data replicas per DataRegion. +3. **SchemaReplicationFactor**: Number of schema replicas per SchemaRegion. +4. **DataRegionConsensusProtocolClass**: Consensus protocol class for DataRegions. +5. **SchemaRegionConsensusProtocolClass**: Consensus protocol class for SchemaRegions. +6. **ConfigNodeConsensusProtocolClass**: Consensus protocol class for ConfigNodes. +7. **TimePartitionOrigin**: The starting timestamp of database time partitions. +8. **TimePartitionInterval**: The interval of database time partitions (in milliseconds). +9. **ReadConsistencyLevel**: The consistency level for read operations. +10. **SchemaRegionPerDataNode**: Number of SchemaRegions per DataNode. +11. **DataRegionPerDataNode**: Number of DataRegions per DataNode. +12. **SeriesSlotNum**: Number of SeriesSlots per DataRegion. +13. **SeriesSlotExecutorClass**: Implementation class for SeriesSlots. +14. **DiskSpaceWarningThreshold**: Disk space warning threshold (in percentage). +15. **TimestampPrecision**: Timestamp precision. + +**Example**: + +```SQL +IoTDB> SHOW VARIABLES; +``` + +**Result**: + +```Plain ++----------------------------------+-----------------------------------------------------------------+ +| Variable| Value| ++----------------------------------+-----------------------------------------------------------------+ +| ClusterName| defaultCluster| +| DataReplicationFactor| 1| +| SchemaReplicationFactor| 1| +| DataRegionConsensusProtocolClass| org.apache.iotdb.consensus.iot.IoTConsensus| +|SchemaRegionConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus| +| ConfigNodeConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus| +| TimePartitionOrigin| 0| +| TimePartitionInterval| 604800000| +| ReadConsistencyLevel| strong| +| SchemaRegionPerDataNode| 1| +| DataRegionPerDataNode| 0| +| SeriesSlotNum| 1000| +| SeriesSlotExecutorClass|org.apache.iotdb.commons.partition.executor.hash.BKDRHashExecutor| +| DiskSpaceWarningThreshold| 0.05| +| TimestampPrecision| ms| ++----------------------------------+-----------------------------------------------------------------+ +``` + +### 1.4 Viewing the Current Timestamp of Database + +**Description**: Returns the current timestamp of the database. + +**Syntax**: + +```SQL +showCurrentTimestampStatement + : SHOW CURRENT_TIMESTAMP + ; +``` + +**Example**: + +```SQL +IoTDB> SHOW CURRENT_TIMESTAMP; +``` + +**Result**: + +```Plain ++-----------------------------+ +| CurrentTimestamp| ++-----------------------------+ +|2025-02-17T11:11:52.987+08:00| ++-----------------------------+ +``` + +### 1.5 Viewing Executing Queries + +**Description**: Displays information about all currently executing queries. + +**Syntax**: + +```SQL +showQueriesStatement + : SHOW (QUERIES | QUERY PROCESSLIST) + (WHERE where=booleanExpression)? + (ORDER BY sortItem (',' sortItem)*)? + limitOffsetClause + ; +``` + +**Parameters**: + +1. **WHERE Clause**: Filters the result set based on specified conditions. +2. **ORDER BY Clause**: Sorts the result set based on specified columns. +3. **limitOffsetClause**: Limits the number of rows returned. + 1. Format: `LIMIT , `. + +**Columns in QUERIES Table**: + +- **time**: Timestamp when the query started. +- **queryid**: Unique ID of the query. +- **datanodeid**: ID of the DataNode executing the query. +- **elapsedtime**: Time elapsed since the query started (in seconds). +- **statement**: The SQL statement being executed. + +**Example**: + +```SQL +IoTDB> SHOW QUERIES WHERE elapsedtime > 0.003 +``` + +**Result**: + +```SQL ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +| Time| QueryId|DataNodeId|ElapsedTime| Statement| ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +|2025-05-09T15:16:01.293+08:00|20250509_071601_00015_1| 1| 0.006|SHOW QUERIES WHERE elapsedtime > 0.003| ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +``` + + +## 2. Status Setting + +### 2.1 Setting the Connected Model + +**Description**: Sets the current SQL dialect model to `Tree` or `Table` which can be used in both tree and table models. + +**Syntax**: + +```SQL +SET SQL_DIALECT = (TABLE | TREE); +``` + +**Example**: + +```SQL +IoTDB> SET SQL_DIALECT=TREE; +IoTDB> SHOW CURRENT_SQL_DIALECT; +``` + +**Result**: + +```SQL ++-----------------+ +|CurrentSqlDialect| ++-----------------+ +| TREE| ++-----------------+ +``` + +### 2.2 Updating Configuration Items + +**Description**: Updates configuration items. Changes take effect immediately without restarting if the items support hot modification. + +**Syntax**: + +```SQL +setConfigurationStatement + : SET CONFIGURATION propertyAssignments (ON INTEGER_VALUE)? + ; + +propertyAssignments + : property (',' property)* + ; + +property + : identifier EQ propertyValue + ; + +propertyValue + : DEFAULT + | expression + ; +``` + +**Parameters**: + +1. **propertyAssignments**: A list of properties to update. + 1. Format: `property (',' property)*`. + 2. Values: + - `DEFAULT`: Resets the configuration to its default value. + - `expression`: A specific value (must be a string). +2. **ON INTEGER_VALUE** **(Optional):** Specifies the node ID to update. + 1. If not specified or set to a negative value, updates all ConfigNodes and DataNodes. + +**Example**: + +```SQL +IoTDB> SET CONFIGURATION "a"='1',b='1' ON 1; +``` + +### 2.3 Loading Manually Modified Configuration Files + +**Description**: Loads manually modified configuration files and hot-loads the changes. Configuration items that support hot modification take effect immediately. + +**Syntax**: + +```SQL +loadConfigurationStatement + : LOAD CONFIGURATION localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **localOrClusterMode** **(Optional):** + 1. Specifies the scope of configuration loading. + 2. Default: `CLUSTER`. + 3. Values: + - `LOCAL`: Loads configuration only on the DataNode directly connected to the client. + - `CLUSTER`: Loads configuration on all DataNodes in the cluster. + +**Example**: + +```SQL +IoTDB> LOAD CONFIGURATION ON LOCAL; +``` + +### 2.4 Setting the System Status + +**Description**: Sets the system status to either `READONLY` or `RUNNING`. + +**Syntax**: + +```SQL +setSystemStatusStatement + : SET SYSTEM TO (READONLY | RUNNING) localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **RUNNING |** **READONLY**: + 1. **RUNNING**: Sets the system to running mode, allowing both read and write operations. + 2. **READONLY**: Sets the system to read-only mode, allowing only read operations and prohibiting writes. +2. **localOrClusterMode** **(Optional):** + 1. **LOCAL**: Applies the status change only to the DataNode directly connected to the client. + 2. **CLUSTER**: Applies the status change to all DataNodes in the cluster. + 3. **Default**: `ON CLUSTER`. + +**Example**: + +```SQL +IoTDB> SET SYSTEM TO READONLY ON CLUSTER; +``` + +## 3. Data Management + +### 3.1 Flushing Data from Memory to Disk + +**Description**: Flushes data from the memory table to disk. + +**Syntax**: + +```SQL +flushStatement + : FLUSH identifier? (',' identifier)* booleanValue? localOrClusterMode? + ; + +booleanValue + : TRUE | FALSE + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **identifier** **(Optional):** + 1. Specifies the name of the path to flush. + 2. If not specified, all paths are flushed. + 3. **Multiple Paths**: Multiple path names can be specified, separated by commas (e.g., `FLUSH root.ln, root.lnm.**`). +2. **booleanValue** **(****Optional****)**: + 1. Specifies the type of data to flush. + 2. **TRUE**: Flushes only the sequential memory table. + 3. **FALSE**: Flushes only the unsequential MemTable. + 4. **Default**: Flushes both sequential and unsequential memory tables. +3. **localOrClusterMode** **(****Optional****)**: + 1. **ON LOCAL**: Flushes only the memory tables on the DataNode directly connected to the client. + 2. **ON CLUSTER**: Flushes memory tables on all DataNodes in the cluster. + 3. **Default:** `ON CLUSTER`. + +**Example**: + +```SQL +IoTDB> FLUSH root.ln TRUE ON LOCAL; +``` + +## 4. Data Repair + +### 4.1 Starting Background Scan and Repair of TsFiles + +**Description**: Starts a background task to scan and repair TsFiles, fixing issues such as timestamp disorder within data files. + +**Syntax**: + +```SQL +startRepairDataStatement + : START REPAIR DATA localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **localOrClusterMode(Optional)**: + 1. **ON LOCAL**: Executes the repair task only on the DataNode directly connected to the client. + 2. **ON CLUSTER**: Executes the repair task on all DataNodes in the cluster. + 3. **Default:** `ON CLUSTER`. + +**Example**: + +```SQL +IoTDB> START REPAIR DATA ON CLUSTER; +``` + +### 4.2 Pausing Background TsFile Repair Task + +**Description**: Pauses the background repair task. The paused task can be resumed by executing the `START REPAIR DATA` command again. + +**Syntax**: + +```SQL +stopRepairDataStatement + : STOP REPAIR DATA localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**Parameters**: + +1. **localOrClusterMode** **(Optional):** + 1. **ON LOCAL**: Executes the pause command only on the DataNode directly connected to the client. + 2. **ON CLUSTER**: Executes the pause command on all DataNodes in the cluster. + 3. **Default:** `ON CLUSTER`. + +**Example**: + +```SQL +IoTDB> STOP REPAIR DATA ON CLUSTER; +``` + +## 5. Query Termination + +### 5.1 Terminating Queries + +**Description**: Terminates one or more running queries. + +**Syntax**: + +```SQL +killQueryStatement + : KILL (QUERY queryId=string | ALL QUERIES) + ; +``` + +**Parameters**: + +1. **QUERY** **queryId:** Specifies the ID of the query to terminate. + +- To obtain the `queryId`, use the `SHOW QUERIES` command. + +2. **ALL QUERIES:** Terminates all currently running queries. + +**Example**: + +Terminate a specific query: + +```SQL +IoTDB> KILL QUERY 20250108_101015_00000_1; +``` + +Terminate all queries: + +```SQL +IoTDB> KILL ALL QUERIES; +``` \ No newline at end of file diff --git a/src/zh/UserGuide/Master/Tree/User-Manual/Maintenance-statement.md b/src/zh/UserGuide/Master/Tree/User-Manual/Maintenance-statement.md new file mode 100644 index 000000000..934909aaa --- /dev/null +++ b/src/zh/UserGuide/Master/Tree/User-Manual/Maintenance-statement.md @@ -0,0 +1,495 @@ + +# 运维语句 + +## 1. 状态查看 + +### 1.1 查看连接的模型 + +**含义**:返回当前连接的 sql_dialect 是树模型/表模型。 + +#### 语法: + +```SQL +showCurrentSqlDialectStatement + : SHOW CURRENT_SQL_DIALECT + ; +``` + +#### 示例: + +```SQL +IoTDB> SHOW CURRENT_SQL_DIALECT +``` + +执行结果如下: + +```SQL ++-----------------+ +|CurrentSqlDialect| ++-----------------+ +| TREE| ++-----------------+ +``` + +### 1.2 查看集群版本 + +**含义**:返回当前集群的版本。 + +#### 语法: + +```SQL +showVersionStatement + : SHOW VERSION + ; +``` + +#### 示例: + +```SQL +IoTDB> SHOW VERSION +``` + +执行结果如下: + +```SQL ++-------+---------+ +|Version|BuildInfo| ++-------+---------+ +|2.0.1.2| 1ca4008| ++-------+---------+ +``` + +### 1.3 查看集群关键参数 + +**含义**:返回当前集群的关键参数。 + +#### 语法: + +```SQL +showVariablesStatement + : SHOW VARIABLES + ; +``` + +关键参数如下: + +1. **ClusterName**:当前集群的名称。 +2. **DataReplicationFactor**:数据副本的数量,表示每个数据分区(DataRegion)的副本数。 +3. **SchemaReplicationFactor**:元数据副本的数量,表示每个元数据分区(SchemaRegion)的副本数。 +4. **DataRegionConsensusProtocolClass**:数据分区(DataRegion)使用的共识协议类。 +5. **SchemaRegionConsensusProtocolClass**:元数据分区(SchemaRegion)使用的共识协议类。 +6. **ConfigNodeConsensusProtocolClass**:配置节点(ConfigNode)使用的共识协议类。 +7. **TimePartitionOrigin**:数据库时间分区的起始时间戳。 +8. **TimePartitionInterval**:数据库的时间分区间隔(单位:毫秒)。 +9. **ReadConsistencyLevel**:读取操作的一致性级别。 +10. **SchemaRegionPerDataNode**:数据节点(DataNode)上的元数据分区(SchemaRegion)数量。 +11. **DataRegionPerDataNode**:数据节点(DataNode)上的数据分区(DataRegion)数量。 +12. **SeriesSlotNum**:数据分区(DataRegion)的序列槽(SeriesSlot)数量。 +13. **SeriesSlotExecutorClass**:序列槽的实现类。 +14. **DiskSpaceWarningThreshold**:磁盘空间告警阈值(单位:百分比)。 +15. **TimestampPrecision**:时间戳精度。 + +#### 示例: + +```SQL +IoTDB> SHOW VARIABLES +``` + +执行结果如下: + +```SQL ++----------------------------------+-----------------------------------------------------------------+ +| Variable| Value| ++----------------------------------+-----------------------------------------------------------------+ +| ClusterName| defaultCluster| +| DataReplicationFactor| 1| +| SchemaReplicationFactor| 1| +| DataRegionConsensusProtocolClass| org.apache.iotdb.consensus.iot.IoTConsensus| +|SchemaRegionConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus| +| ConfigNodeConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus| +| TimePartitionOrigin| 0| +| TimePartitionInterval| 604800000| +| ReadConsistencyLevel| strong| +| SchemaRegionPerDataNode| 1| +| DataRegionPerDataNode| 0| +| SeriesSlotNum| 1000| +| SeriesSlotExecutorClass|org.apache.iotdb.commons.partition.executor.hash.BKDRHashExecutor| +| DiskSpaceWarningThreshold| 0.05| +| TimestampPrecision| ms| ++----------------------------------+-----------------------------------------------------------------+ +``` + +### 1.4 查看数据库当前时间 + +#### 语法: + +**含义**:返回数据库当前时间。 + +```SQL +showCurrentTimestampStatement + : SHOW CURRENT_TIMESTAMP + ; +``` + +#### 示例: + +```SQL +IoTDB> SHOW CURRENT_TIMESTAMP +``` + +执行结果如下: + +```SQL ++-----------------------------+ +| CurrentTimestamp| ++-----------------------------+ +|2025-02-17T11:11:52.987+08:00| ++-----------------------------+ +``` + +### 1.5 查看正在执行的查询信息 + +**含义**:用于显示所有正在执行的查询信息。 + +#### 语法: + +```SQL +showQueriesStatement + : SHOW (QUERIES | QUERY PROCESSLIST) + (WHERE where=booleanExpression)? + (ORDER BY sortItem (',' sortItem)*)? + limitOffsetClause + ; +``` + +**参数解释**: + +1. **WHERE** 子句:需保证过滤的目标列是结果集中存在的列 +2. **ORDER BY** 子句:需保证`sortKey`是结果集中存在的列 +3. **limitOffsetClause**: + - **含义**:用于限制结果集的返回数量。 + - **格式**:`LIMIT , `, `` 是偏移量,`` 是返回的行数。 +4. **QUERIES** 表中的列: + - **time**:查询开始的时间戳,时间戳精度与系统精度一致 + - **queryid**:查询语句的 ID + - **datanodeid**:发起查询语句的 DataNode 的ID + - **elapsedtime**:查询的执行耗时,单位是秒 + - **statement**:查询的 SQL 语句 + + +#### 示例: + +```SQL +IoTDB> SHOW QUERIES WHERE elapsedtime > 0.003 +``` + +执行结果如下: + +```SQL ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +| Time| QueryId|DataNodeId|ElapsedTime| Statement| ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +|2025-05-09T15:16:01.293+08:00|20250509_071601_00015_1| 1| 0.006|SHOW QUERIES WHERE elapsedtime > 0.003| ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +``` + +## 2. 状态设置 + +### 2.1 设置连接的模型 + +**含义**:将当前连接的 sql_dialect 置为树模型/表模型,在树模型和表模型中均可使用该命令。 + +#### 语法: + +```SQL +SET SQL_DIALECT EQ (TABLE | TREE) +``` + +#### 示例: + +```SQL +IoTDB> SET SQL_DIALECT=TREE +IoTDB> SHOW CURRENT_SQL_DIALECT +``` + +执行结果如下: + +```SQL ++-----------------+ +|CurrentSqlDialect| ++-----------------+ +| TREE| ++-----------------+ +``` + +### 2.2 更新配置项 + +**含义**:用于更新配置项,执行完成后会进行配置项的热加载,对于支持热修改的配置项会立即生效。 + +#### 语法: + +```SQL +setConfigurationStatement + : SET CONFIGURATION propertyAssignments (ON INTEGER_VALUE)? + ; + +propertyAssignments + : property (',' property)* + ; + +property + : identifier EQ propertyValue + ; + +propertyValue + : DEFAULT + | expression + ; +``` + +**参数解释**: + +1. **propertyAssignments** + - **含义**:更新的配置列表,由多个 `property` 组成。 + - 可以更新多个配置列表,用逗号分隔。 + - **取值**: + - `DEFAULT`:将配置项恢复为默认值。 + - `expression`:具体的值,必须是一个字符串。 +2. **ON INTEGER_VALUE** + - **含义**:指定要更新配置的节点 ID。 + - **可选性**:可选。如果不指定或指定的值低于 0,则更新所有 ConfigNode 和 DataNode 的配置。 + +#### 示例: + +```SQL +IoTDB> SET CONFIGURATION "a"='1',b='1' ON 1; +``` + +### 2.3 读取手动修改的配置文件 + +**含义**:用于读取手动修改过的配置文件,并对配置项进行热加载,对于支持热修改的配置项会立即生效。 + +#### 语法: + +```SQL +loadConfigurationStatement + : LOAD CONFIGURATION localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **localOrClusterMode** + - **含义**:指定配置热加载的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `LOCAL`:只对客户端直连的 DataNode 进行配置热加载。 + - `CLUSTER`:对集群中所有 DataNode 进行配置热加载。 + +#### 示例: + +```SQL +IoTDB> LOAD CONFIGURATION ON LOCAL; +``` + +### 2.4 设置系统的状态 + +**含义**:用于设置系统的状态。 + +#### 语法: + +```SQL +setSystemStatusStatement + : SET SYSTEM TO (READONLY | RUNNING) localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **RUNNING | READONLY** + - **含义**:指定系统的新状态。 + - **取值**: + - `RUNNING`:将系统设置为运行状态,允许读写操作。 + - `READONLY`:将系统设置为只读状态,只允许读取操作,禁止写入操作。 +2. **localOrClusterMode** + - **含义**:指定状态变更的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `LOCAL`:仅对客户端直连的 DataNode 生效。 + - `CLUSTER`:对集群中所有 DataNode 生效。 + +#### 示例: + +```SQL +IoTDB> SET SYSTEM TO READONLY ON CLUSTER; +``` + + +## 3. 数据管理 + +### 3.1 刷写内存表中的数据到磁盘 + +**含义**:将内存表中的数据刷写到磁盘上。 + +#### 语法: + +```SQL +flushStatement + : FLUSH identifier? (',' identifier)* booleanValue? localOrClusterMode? + ; + +booleanValue + : TRUE | FALSE + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **identifier** + - **含义**:指定要刷写的路径名称。 + - **可选性**:可选。如果不指定,则默认刷写所有路径。 + - **多个路径**:可以指定多个路径名称,用逗号分隔。例如:`FLUSH root.ln, root.lnm`。 +2. **booleanValue** + - **含义**:指定刷写的内容。 + - **可选性**:可选。如果不指定,则默认刷写顺序和乱序空间的内存。 + - **取值**: + - `TRUE`:只刷写顺序空间的内存表。 + - `FALSE`:只刷写乱序空间的MemTable。 +3. **localOrClusterMode** + - **含义**:指定刷写的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `ON LOCAL`:只刷写客户端直连的 DataNode 上的内存表。 + - `ON CLUSTER`:刷写集群中所有 DataNode 上的内存表。 + +#### 示例: + +```SQL +IoTDB> FLUSH root.ln TRUE ON LOCAL; +``` + +## 4. 数据修复 + +### 4.1 启动后台扫描并修复 tsfile 任务 + +**含义**:启动一个后台任务,开始扫描并修复 tsfile,能够修复数据文件内的时间戳乱序类异常。 + +#### 语法: + +```SQL +startRepairDataStatement + : START REPAIR DATA localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **localOrClusterMode** + - **含义**:指定数据修复的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `ON LOCAL`:仅对客户端直连的 DataNode 执行。 + - `ON CLUSTER`:对集群中所有 DataNode 执行。 + +#### 示例: + +```SQL +IoTDB> START REPAIR DATA ON CLUSTER; +``` + +### 4.2 暂停后台修复 tsfile 任务 + +**含义**:暂停后台的修复任务,暂停中的任务可通过再次执行 start repair data 命令恢复。 + +#### 语法: + +```SQL +stopRepairDataStatement + : STOP REPAIR DATA localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **localOrClusterMode** + - **含义**:指定数据修复的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `ON LOCAL`:仅对客户端直连的 DataNode 执行。 + - `ON CLUSTER`:对集群中所有 DataNode 执行。 + +#### 示例: + +```SQL +IoTDB> STOP REPAIR DATA ON CLUSTER; +``` + +## 5. 终止查询 + +### 5.1 主动终止查询 + +**含义**:使用该命令主动地终止查询。 + +#### 语法: + +```SQL +killQueryStatement + : KILL (QUERY queryId=string | ALL QUERIES) + ; +``` + +**参数解释**: + +1. **QUERY queryId=string** + - **含义**:指定要终止的查询的 ID。 `` 是正在执行的查询的唯一标识符。 + - **获取查询 ID**:可以通过 `SHOW QUERIES` 命令获取所有正在执行的查询及其 ID。 +2. **ALL QUERIES** + - **含义**:终止所有正在执行的查询。 + +#### 示例: + +通过指定 `queryId` 可以中止指定的查询,为了获取正在执行的查询 id,用户可以使用 show queries 命令,该命令将显示所有正在执行的查询列表。 + +```SQL +IoTDB> KILL QUERY 20250108_101015_00000_1; -- 终止指定query +IoTDB> KILL ALL QUERIES; -- 终止所有query +``` \ No newline at end of file diff --git a/src/zh/UserGuide/V1.3.x/User-Manual/Maintenance-statement.md b/src/zh/UserGuide/V1.3.x/User-Manual/Maintenance-statement.md new file mode 100644 index 000000000..42f5a9532 --- /dev/null +++ b/src/zh/UserGuide/V1.3.x/User-Manual/Maintenance-statement.md @@ -0,0 +1,440 @@ + +# 运维语句 + +## 1. 状态查看 + +### 1.1 查看集群版本 + +**含义**:返回当前集群的版本。 + +#### 语法: + +```SQL +showVersionStatement + : SHOW VERSION + ; +``` + +#### 示例: + +```SQL +IoTDB> SHOW VERSION +``` + +执行结果如下: + +```SQL ++-------+-----------+ +|Version| BuildInfo| ++-------+-----------+ +|1.3.4.1|e5334cf-dev| ++-------+-----------+ +``` + +### 1.2 查看集群关键参数 + +**含义**:返回当前集群的关键参数。 + +#### 语法: + +```SQL +showVariablesStatement + : SHOW VARIABLES + ; +``` + +关键参数如下: + +1. **ClusterName**:当前集群的名称。 +2. **DataReplicationFactor**:数据副本的数量,表示每个数据分区(DataRegion)的副本数。 +3. **SchemaReplicationFactor**:元数据副本的数量,表示每个元数据分区(SchemaRegion)的副本数。 +4. **DataRegionConsensusProtocolClass**:数据分区(DataRegion)使用的共识协议类。 +5. **SchemaRegionConsensusProtocolClass**:元数据分区(SchemaRegion)使用的共识协议类。 +6. **ConfigNodeConsensusProtocolClass**:配置节点(ConfigNode)使用的共识协议类。 +7. **TimePartitionOrigin**:数据库时间分区的起始时间戳。 +8. **TimePartitionInterval**:数据库的时间分区间隔(单位:毫秒)。 +9. **ReadConsistencyLevel**:读取操作的一致性级别。 +10. **SchemaRegionPerDataNode**:数据节点(DataNode)上的元数据分区(SchemaRegion)数量。 +11. **DataRegionPerDataNode**:数据节点(DataNode)上的数据分区(DataRegion)数量。 +12. **SeriesSlotNum**:数据分区(DataRegion)的序列槽(SeriesSlot)数量。 +13. **SeriesSlotExecutorClass**:序列槽的实现类。 +14. **DiskSpaceWarningThreshold**:磁盘空间告警阈值(单位:百分比)。 +15. **TimestampPrecision**:时间戳精度。 + +#### 示例: + +```SQL +IoTDB> SHOW VARIABLES +``` + +执行结果如下: + +```SQL ++----------------------------------+-----------------------------------------------------------------+ +| Variable| Value| ++----------------------------------+-----------------------------------------------------------------+ +| ClusterName| defaultCluster| +| DataReplicationFactor| 1| +| SchemaReplicationFactor| 1| +| DataRegionConsensusProtocolClass| org.apache.iotdb.consensus.iot.IoTConsensus| +|SchemaRegionConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus| +| ConfigNodeConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus| +| TimePartitionOrigin| 0| +| TimePartitionInterval| 604800000| +| ReadConsistencyLevel| strong| +| SchemaRegionPerDataNode| 1| +| DataRegionPerDataNode| 0| +| SeriesSlotNum| 1000| +| SeriesSlotExecutorClass|org.apache.iotdb.commons.partition.executor.hash.BKDRHashExecutor| +| DiskSpaceWarningThreshold| 0.05| +| TimestampPrecision| ms| ++----------------------------------+-----------------------------------------------------------------+ +``` + +### 1.3 查看数据库当前时间 + +#### 语法: + +**含义**:返回数据库当前时间。 + +```SQL +showCurrentTimestampStatement + : SHOW CURRENT_TIMESTAMP + ; +``` + +#### 示例: + +```SQL +IoTDB> SHOW CURRENT_TIMESTAMP +``` + +执行结果如下: + +```SQL ++-----------------------------+ +| CurrentTimestamp| ++-----------------------------+ +|2025-02-17T11:11:52.987+08:00| ++-----------------------------+ +``` + +### 1.4 查看正在执行的查询信息 + +**含义**:用于显示所有正在执行的查询信息。 + +#### 语法: + +```SQL +showQueriesStatement + : SHOW (QUERIES | QUERY PROCESSLIST) + (WHERE where=booleanExpression)? + (ORDER BY sortItem (',' sortItem)*)? + limitOffsetClause + ; +``` + +**参数解释**: + +1. **WHERE** 子句:需保证过滤的目标列是结果集中存在的列 +2. **ORDER BY** 子句:需保证`sortKey`是结果集中存在的列 +3. **limitOffsetClause**: + - **含义**:用于限制结果集的返回数量。 + - **格式**:`LIMIT , `, `` 是偏移量,`` 是返回的行数。 +4. **QUERIES** 表中的列: + - **time**:查询开始的时间戳,时间戳精度与系统精度一致 + - **queryid**:查询语句的 ID + - **datanodeid**:发起查询语句的 DataNode 的ID + - **elapsedtime**:查询的执行耗时,单位是秒 + - **statement**:查询的 SQL 语句 + + +#### 示例: + +```SQL +IoTDB> SHOW QUERIES WHERE elapsedtime > 0.003 +``` + +执行结果如下: + +```SQL ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +| Time| QueryId|DataNodeId|ElapsedTime| Statement| ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +|2025-05-09T15:16:01.293+08:00|20250509_071601_00015_1| 1| 0.006|SHOW QUERIES WHERE elapsedtime > 0.003| ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +``` + +## 2. 状态设置 + +### 2.1 更新配置项 + +**含义**:用于更新配置项,执行完成后会进行配置项的热加载,对于支持热修改的配置项会立即生效。 + +#### 语法: + +```SQL +setConfigurationStatement + : SET CONFIGURATION propertyAssignments (ON INTEGER_VALUE)? + ; + +propertyAssignments + : property (',' property)* + ; + +property + : identifier EQ propertyValue + ; + +propertyValue + : DEFAULT + | expression + ; +``` + +**参数解释**: + +1. **propertyAssignments** + - **含义**:更新的配置列表,由多个 `property` 组成。 + - 可以更新多个配置列表,用逗号分隔。 + - **取值**: + - `DEFAULT`:将配置项恢复为默认值。 + - `expression`:具体的值,必须是一个字符串。 +2. **ON INTEGER_VALUE** + - **含义**:指定要更新配置的节点 ID。 + - **可选性**:可选。如果不指定或指定的值低于 0,则更新所有 ConfigNode 和 DataNode 的配置。 + +#### 示例: + +```SQL +IoTDB> SET CONFIGURATION "a"='1',b='1' ON 1; +``` + +### 2.2 读取手动修改的配置文件 + +**含义**:用于读取手动修改过的配置文件,并对配置项进行热加载,对于支持热修改的配置项会立即生效。 + +#### 语法: + +```SQL +loadConfigurationStatement + : LOAD CONFIGURATION localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **localOrClusterMode** + - **含义**:指定配置热加载的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `LOCAL`:只对客户端直连的 DataNode 进行配置热加载。 + - `CLUSTER`:对集群中所有 DataNode 进行配置热加载。 + +#### 示例: + +```SQL +IoTDB> LOAD CONFIGURATION ON LOCAL; +``` + +### 2.3 设置系统的状态 + +**含义**:用于设置系统的状态。 + +#### 语法: + +```SQL +setSystemStatusStatement + : SET SYSTEM TO (READONLY | RUNNING) localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **RUNNING | READONLY** + - **含义**:指定系统的新状态。 + - **取值**: + - `RUNNING`:将系统设置为运行状态,允许读写操作。 + - `READONLY`:将系统设置为只读状态,只允许读取操作,禁止写入操作。 +2. **localOrClusterMode** + - **含义**:指定状态变更的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `LOCAL`:仅对客户端直连的 DataNode 生效。 + - `CLUSTER`:对集群中所有 DataNode 生效。 + +#### 示例: + +```SQL +IoTDB> SET SYSTEM TO READONLY ON CLUSTER; +``` + + +## 3. 数据管理 + +### 3.1 刷写内存表中的数据到磁盘 + +**含义**:将内存表中的数据刷写到磁盘上。 + +#### 语法: + +```SQL +flushStatement + : FLUSH identifier? (',' identifier)* booleanValue? localOrClusterMode? + ; + +booleanValue + : TRUE | FALSE + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **identifier** + - **含义**:指定要刷写的数据库名称。 + - **可选性**:可选。如果不指定,则默认刷写所有数据库。 + - **多个数据库**:可以指定多个数据库名称,用逗号分隔。例如:`FLUSH root.ln, root.lnm`。 +2. **booleanValue** + - **含义**:指定刷写的内容。 + - **可选性**:可选。如果不指定,则默认刷写顺序和乱序空间的内存。 + - **取值**: + - `TRUE`:只刷写顺序空间的内存表。 + - `FALSE`:只刷写乱序空间的MemTable。 +3. **localOrClusterMode** + - **含义**:指定刷写的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `ON LOCAL`:只刷写客户端直连的 DataNode 上的内存表。 + - `ON CLUSTER`:刷写集群中所有 DataNode 上的内存表。 + +#### 示例: + +```SQL +IoTDB> FLUSH root.ln TRUE ON LOCAL; +``` + +## 4. 数据修复 + +### 4.1 启动后台扫描并修复 tsfile 任务 + +**含义**:启动一个后台任务,开始扫描并修复 tsfile,能够修复数据文件内的时间戳乱序类异常。 + +#### 语法: + +```SQL +startRepairDataStatement + : START REPAIR DATA localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **localOrClusterMode** + - **含义**:指定数据修复的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `ON LOCAL`:仅对客户端直连的 DataNode 执行。 + - `ON CLUSTER`:对集群中所有 DataNode 执行。 + +#### 示例: + +```SQL +IoTDB> START REPAIR DATA ON CLUSTER; +``` + +### 4.2 暂停后台修复 tsfile 任务 + +**含义**:暂停后台的修复任务,暂停中的任务可通过再次执行 start repair data 命令恢复。 + +#### 语法: + +```SQL +stopRepairDataStatement + : STOP REPAIR DATA localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **localOrClusterMode** + - **含义**:指定数据修复的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `ON LOCAL`:仅对客户端直连的 DataNode 执行。 + - `ON CLUSTER`:对集群中所有 DataNode 执行。 + +#### 示例: + +```SQL +IoTDB> STOP REPAIR DATA ON CLUSTER; +``` + +## 5. 终止查询 + +### 5.1 主动终止查询 + +**含义**:使用该命令主动地终止查询。 + +#### 语法: + +```SQL +killQueryStatement + : KILL (QUERY queryId=string | ALL QUERIES) + ; +``` + +**参数解释**: + +1. **QUERY queryId=string** + - **含义**:指定要终止的查询的 ID。 `` 是正在执行的查询的唯一标识符。 + - **获取查询 ID**:可以通过 `SHOW QUERIES` 命令获取所有正在执行的查询及其 ID。 +2. **ALL QUERIES** + - **含义**:终止所有正在执行的查询。 + +#### 示例: + +通过指定 `queryId` 可以中止指定的查询,为了获取正在执行的查询 id,用户可以使用 show queries 命令,该命令将显示所有正在执行的查询列表。 + +```SQL +IoTDB> KILL QUERY 20250108_101015_00000_1; -- 终止指定query +IoTDB> KILL ALL QUERIES; -- 终止所有query +``` \ No newline at end of file diff --git a/src/zh/UserGuide/dev-1.3/User-Manual/Maintenance-statement.md b/src/zh/UserGuide/dev-1.3/User-Manual/Maintenance-statement.md new file mode 100644 index 000000000..d26ba5cf9 --- /dev/null +++ b/src/zh/UserGuide/dev-1.3/User-Manual/Maintenance-statement.md @@ -0,0 +1,440 @@ + +# 运维语句 + +## 1. 状态查看 + +### 1.1 查看集群版本 + +**含义**:返回当前集群的版本。 + +#### 语法: + +```SQL +showVersionStatement + : SHOW VERSION + ; +``` + +#### 示例: + +```SQL +IoTDB> SHOW VERSION +``` + +执行结果如下: + +```SQL ++-------+-----------+ +|Version| BuildInfo| ++-------+-----------+ +|1.3.4.1|e5334cf-dev| ++-------+-----------+ +``` + +### 1.2 查看集群关键参数 + +**含义**:返回当前集群的关键参数。 + +#### 语法: + +```SQL +showVariablesStatement + : SHOW VARIABLES + ; +``` + +关键参数如下: + +1. **ClusterName**:当前集群的名称。 +2. **DataReplicationFactor**:数据副本的数量,表示每个数据分区(DataRegion)的副本数。 +3. **SchemaReplicationFactor**:元数据副本的数量,表示每个元数据分区(SchemaRegion)的副本数。 +4. **DataRegionConsensusProtocolClass**:数据分区(DataRegion)使用的共识协议类。 +5. **SchemaRegionConsensusProtocolClass**:元数据分区(SchemaRegion)使用的共识协议类。 +6. **ConfigNodeConsensusProtocolClass**:配置节点(ConfigNode)使用的共识协议类。 +7. **TimePartitionOrigin**:数据库时间分区的起始时间戳。 +8. **TimePartitionInterval**:数据库的时间分区间隔(单位:毫秒)。 +9. **ReadConsistencyLevel**:读取操作的一致性级别。 +10. **SchemaRegionPerDataNode**:数据节点(DataNode)上的元数据分区(SchemaRegion)数量。 +11. **DataRegionPerDataNode**:数据节点(DataNode)上的数据分区(DataRegion)数量。 +12. **SeriesSlotNum**:数据分区(DataRegion)的序列槽(SeriesSlot)数量。 +13. **SeriesSlotExecutorClass**:序列槽的实现类。 +14. **DiskSpaceWarningThreshold**:磁盘空间告警阈值(单位:百分比)。 +15. **TimestampPrecision**:时间戳精度。 + +#### 示例: + +```SQL +IoTDB> SHOW VARIABLES +``` + +执行结果如下: + +```SQL ++----------------------------------+-----------------------------------------------------------------+ +| Variable| Value| ++----------------------------------+-----------------------------------------------------------------+ +| ClusterName| defaultCluster| +| DataReplicationFactor| 1| +| SchemaReplicationFactor| 1| +| DataRegionConsensusProtocolClass| org.apache.iotdb.consensus.iot.IoTConsensus| +|SchemaRegionConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus| +| ConfigNodeConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus| +| TimePartitionOrigin| 0| +| TimePartitionInterval| 604800000| +| ReadConsistencyLevel| strong| +| SchemaRegionPerDataNode| 1| +| DataRegionPerDataNode| 0| +| SeriesSlotNum| 1000| +| SeriesSlotExecutorClass|org.apache.iotdb.commons.partition.executor.hash.BKDRHashExecutor| +| DiskSpaceWarningThreshold| 0.05| +| TimestampPrecision| ms| ++----------------------------------+-----------------------------------------------------------------+ +``` + +### 1.3 查看数据库当前时间 + +#### 语法: + +**含义**:返回数据库当前时间。 + +```SQL +showCurrentTimestampStatement + : SHOW CURRENT_TIMESTAMP + ; +``` + +#### 示例: + +```SQL +IoTDB> SHOW CURRENT_TIMESTAMP +``` + +执行结果如下: + +```SQL ++-----------------------------+ +| CurrentTimestamp| ++-----------------------------+ +|2025-02-17T11:11:52.987+08:00| ++-----------------------------+ +``` + +### 1.4 查看正在执行的查询信息 + +**含义**:用于显示所有正在执行的查询信息。 + +#### 语法: + +```SQL +showQueriesStatement + : SHOW (QUERIES | QUERY PROCESSLIST) + (WHERE where=booleanExpression)? + (ORDER BY sortItem (',' sortItem)*)? + limitOffsetClause + ; +``` + +**参数解释**: + +1. **WHERE** 子句:需保证过滤的目标列是结果集中存在的列 +2. **ORDER BY** 子句:需保证`sortKey`是结果集中存在的列 +3. **limitOffsetClause**: + - **含义**:用于限制结果集的返回数量。 + - **格式**:`LIMIT , `, `` 是偏移量,`` 是返回的行数。 +4. **QUERIES** 表中的列: + - **time**:查询开始的时间戳,时间戳精度与系统精度一致 + - **queryid**:查询语句的 ID + - **datanodeid**:发起查询语句的 DataNode 的ID + - **elapsedtime**:查询的执行耗时,单位是秒 + - **statement**:查询的 SQL 语句 + + +#### 示例: + +```SQL +IoTDB> SHOW QUERIES WHERE elapsedtime > 0.003 +``` + +执行结果如下: + +```SQL ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +| Time| QueryId|DataNodeId|ElapsedTime| Statement| ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +|2025-05-09T15:16:01.293+08:00|20250509_071601_00015_1| 1| 0.006|SHOW QUERIES WHERE elapsedtime > 0.003| ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +``` + +## 2. 状态设置 + +### 2.1 更新配置项 + +**含义**:用于更新配置项,执行完成后会进行配置项的热加载,对于支持热修改的配置项会立即生效。 + +#### 语法: + +```SQL +setConfigurationStatement + : SET CONFIGURATION propertyAssignments (ON INTEGER_VALUE)? + ; + +propertyAssignments + : property (',' property)* + ; + +property + : identifier EQ propertyValue + ; + +propertyValue + : DEFAULT + | expression + ; +``` + +**参数解释**: + +1. **propertyAssignments** + - **含义**:更新的配置列表,由多个 `property` 组成。 + - 可以更新多个配置列表,用逗号分隔。 + - **取值**: + - `DEFAULT`:将配置项恢复为默认值。 + - `expression`:具体的值,必须是一个字符串。 +2. **ON INTEGER_VALUE** + - **含义**:指定要更新配置的节点 ID。 + - **可选性**:可选。如果不指定或指定的值低于 0,则更新所有 ConfigNode 和 DataNode 的配置。 + +#### 示例: + +```SQL +IoTDB> SET CONFIGURATION "a"='1',b='1' ON 1; +``` + +### 2.2 读取手动修改的配置文件 + +**含义**:用于读取手动修改过的配置文件,并对配置项进行热加载,对于支持热修改的配置项会立即生效。 + +#### 语法: + +```SQL +loadConfigurationStatement + : LOAD CONFIGURATION localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **localOrClusterMode** + - **含义**:指定配置热加载的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `LOCAL`:只对客户端直连的 DataNode 进行配置热加载。 + - `CLUSTER`:对集群中所有 DataNode 进行配置热加载。 + +#### 示例: + +```SQL +IoTDB> LOAD CONFIGURATION ON LOCAL; +``` + +### 2.3 设置系统的状态 + +**含义**:用于设置系统的状态。 + +#### 语法: + +```SQL +setSystemStatusStatement + : SET SYSTEM TO (READONLY | RUNNING) localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **RUNNING | READONLY** + - **含义**:指定系统的新状态。 + - **取值**: + - `RUNNING`:将系统设置为运行状态,允许读写操作。 + - `READONLY`:将系统设置为只读状态,只允许读取操作,禁止写入操作。 +2. **localOrClusterMode** + - **含义**:指定状态变更的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `LOCAL`:仅对客户端直连的 DataNode 生效。 + - `CLUSTER`:对集群中所有 DataNode 生效。 + +#### 示例: + +```SQL +IoTDB> SET SYSTEM TO READONLY ON CLUSTER; +``` + + +## 3. 数据管理 + +### 3.1 刷写内存表中的数据到磁盘 + +**含义**:将内存表中的数据刷写到磁盘上。 + +#### 语法: + +```SQL +flushStatement + : FLUSH identifier? (',' identifier)* booleanValue? localOrClusterMode? + ; + +booleanValue + : TRUE | FALSE + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **identifier** + - **含义**:指定要刷写的路径名称。 + - **可选性**:可选。如果不指定,则默认刷写所有路径。 + - **多个路径**:可以指定多个路径名称,用逗号分隔。例如:`FLUSH root.ln, root.lnm`。 +2. **booleanValue** + - **含义**:指定刷写的内容。 + - **可选性**:可选。如果不指定,则默认刷写顺序和乱序空间的内存。 + - **取值**: + - `TRUE`:只刷写顺序空间的内存表。 + - `FALSE`:只刷写乱序空间的MemTable。 +3. **localOrClusterMode** + - **含义**:指定刷写的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `ON LOCAL`:只刷写客户端直连的 DataNode 上的内存表。 + - `ON CLUSTER`:刷写集群中所有 DataNode 上的内存表。 + +#### 示例: + +```SQL +IoTDB> FLUSH root.ln TRUE ON LOCAL; +``` + +## 4. 数据修复 + +### 4.1 启动后台扫描并修复 tsfile 任务 + +**含义**:启动一个后台任务,开始扫描并修复 tsfile,能够修复数据文件内的时间戳乱序类异常。 + +#### 语法: + +```SQL +startRepairDataStatement + : START REPAIR DATA localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **localOrClusterMode** + - **含义**:指定数据修复的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `ON LOCAL`:仅对客户端直连的 DataNode 执行。 + - `ON CLUSTER`:对集群中所有 DataNode 执行。 + +#### 示例: + +```SQL +IoTDB> START REPAIR DATA ON CLUSTER; +``` + +### 4.2 暂停后台修复 tsfile 任务 + +**含义**:暂停后台的修复任务,暂停中的任务可通过再次执行 start repair data 命令恢复。 + +#### 语法: + +```SQL +stopRepairDataStatement + : STOP REPAIR DATA localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **localOrClusterMode** + - **含义**:指定数据修复的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `ON LOCAL`:仅对客户端直连的 DataNode 执行。 + - `ON CLUSTER`:对集群中所有 DataNode 执行。 + +#### 示例: + +```SQL +IoTDB> STOP REPAIR DATA ON CLUSTER; +``` + +## 5. 终止查询 + +### 5.1 主动终止查询 + +**含义**:使用该命令主动地终止查询。 + +#### 语法: + +```SQL +killQueryStatement + : KILL (QUERY queryId=string | ALL QUERIES) + ; +``` + +**参数解释**: + +1. **QUERY queryId=string** + - **含义**:指定要终止的查询的 ID。 `` 是正在执行的查询的唯一标识符。 + - **获取查询 ID**:可以通过 `SHOW QUERIES` 命令获取所有正在执行的查询及其 ID。 +2. **ALL QUERIES** + - **含义**:终止所有正在执行的查询。 + +#### 示例: + +通过指定 `queryId` 可以中止指定的查询,为了获取正在执行的查询 id,用户可以使用 show queries 命令,该命令将显示所有正在执行的查询列表。 + +```SQL +IoTDB> KILL QUERY 20250108_101015_00000_1; -- 终止指定query +IoTDB> KILL ALL QUERIES; -- 终止所有query +``` \ No newline at end of file diff --git a/src/zh/UserGuide/latest/User-Manual/Maintenance-statement.md b/src/zh/UserGuide/latest/User-Manual/Maintenance-statement.md new file mode 100644 index 000000000..934909aaa --- /dev/null +++ b/src/zh/UserGuide/latest/User-Manual/Maintenance-statement.md @@ -0,0 +1,495 @@ + +# 运维语句 + +## 1. 状态查看 + +### 1.1 查看连接的模型 + +**含义**:返回当前连接的 sql_dialect 是树模型/表模型。 + +#### 语法: + +```SQL +showCurrentSqlDialectStatement + : SHOW CURRENT_SQL_DIALECT + ; +``` + +#### 示例: + +```SQL +IoTDB> SHOW CURRENT_SQL_DIALECT +``` + +执行结果如下: + +```SQL ++-----------------+ +|CurrentSqlDialect| ++-----------------+ +| TREE| ++-----------------+ +``` + +### 1.2 查看集群版本 + +**含义**:返回当前集群的版本。 + +#### 语法: + +```SQL +showVersionStatement + : SHOW VERSION + ; +``` + +#### 示例: + +```SQL +IoTDB> SHOW VERSION +``` + +执行结果如下: + +```SQL ++-------+---------+ +|Version|BuildInfo| ++-------+---------+ +|2.0.1.2| 1ca4008| ++-------+---------+ +``` + +### 1.3 查看集群关键参数 + +**含义**:返回当前集群的关键参数。 + +#### 语法: + +```SQL +showVariablesStatement + : SHOW VARIABLES + ; +``` + +关键参数如下: + +1. **ClusterName**:当前集群的名称。 +2. **DataReplicationFactor**:数据副本的数量,表示每个数据分区(DataRegion)的副本数。 +3. **SchemaReplicationFactor**:元数据副本的数量,表示每个元数据分区(SchemaRegion)的副本数。 +4. **DataRegionConsensusProtocolClass**:数据分区(DataRegion)使用的共识协议类。 +5. **SchemaRegionConsensusProtocolClass**:元数据分区(SchemaRegion)使用的共识协议类。 +6. **ConfigNodeConsensusProtocolClass**:配置节点(ConfigNode)使用的共识协议类。 +7. **TimePartitionOrigin**:数据库时间分区的起始时间戳。 +8. **TimePartitionInterval**:数据库的时间分区间隔(单位:毫秒)。 +9. **ReadConsistencyLevel**:读取操作的一致性级别。 +10. **SchemaRegionPerDataNode**:数据节点(DataNode)上的元数据分区(SchemaRegion)数量。 +11. **DataRegionPerDataNode**:数据节点(DataNode)上的数据分区(DataRegion)数量。 +12. **SeriesSlotNum**:数据分区(DataRegion)的序列槽(SeriesSlot)数量。 +13. **SeriesSlotExecutorClass**:序列槽的实现类。 +14. **DiskSpaceWarningThreshold**:磁盘空间告警阈值(单位:百分比)。 +15. **TimestampPrecision**:时间戳精度。 + +#### 示例: + +```SQL +IoTDB> SHOW VARIABLES +``` + +执行结果如下: + +```SQL ++----------------------------------+-----------------------------------------------------------------+ +| Variable| Value| ++----------------------------------+-----------------------------------------------------------------+ +| ClusterName| defaultCluster| +| DataReplicationFactor| 1| +| SchemaReplicationFactor| 1| +| DataRegionConsensusProtocolClass| org.apache.iotdb.consensus.iot.IoTConsensus| +|SchemaRegionConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus| +| ConfigNodeConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus| +| TimePartitionOrigin| 0| +| TimePartitionInterval| 604800000| +| ReadConsistencyLevel| strong| +| SchemaRegionPerDataNode| 1| +| DataRegionPerDataNode| 0| +| SeriesSlotNum| 1000| +| SeriesSlotExecutorClass|org.apache.iotdb.commons.partition.executor.hash.BKDRHashExecutor| +| DiskSpaceWarningThreshold| 0.05| +| TimestampPrecision| ms| ++----------------------------------+-----------------------------------------------------------------+ +``` + +### 1.4 查看数据库当前时间 + +#### 语法: + +**含义**:返回数据库当前时间。 + +```SQL +showCurrentTimestampStatement + : SHOW CURRENT_TIMESTAMP + ; +``` + +#### 示例: + +```SQL +IoTDB> SHOW CURRENT_TIMESTAMP +``` + +执行结果如下: + +```SQL ++-----------------------------+ +| CurrentTimestamp| ++-----------------------------+ +|2025-02-17T11:11:52.987+08:00| ++-----------------------------+ +``` + +### 1.5 查看正在执行的查询信息 + +**含义**:用于显示所有正在执行的查询信息。 + +#### 语法: + +```SQL +showQueriesStatement + : SHOW (QUERIES | QUERY PROCESSLIST) + (WHERE where=booleanExpression)? + (ORDER BY sortItem (',' sortItem)*)? + limitOffsetClause + ; +``` + +**参数解释**: + +1. **WHERE** 子句:需保证过滤的目标列是结果集中存在的列 +2. **ORDER BY** 子句:需保证`sortKey`是结果集中存在的列 +3. **limitOffsetClause**: + - **含义**:用于限制结果集的返回数量。 + - **格式**:`LIMIT , `, `` 是偏移量,`` 是返回的行数。 +4. **QUERIES** 表中的列: + - **time**:查询开始的时间戳,时间戳精度与系统精度一致 + - **queryid**:查询语句的 ID + - **datanodeid**:发起查询语句的 DataNode 的ID + - **elapsedtime**:查询的执行耗时,单位是秒 + - **statement**:查询的 SQL 语句 + + +#### 示例: + +```SQL +IoTDB> SHOW QUERIES WHERE elapsedtime > 0.003 +``` + +执行结果如下: + +```SQL ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +| Time| QueryId|DataNodeId|ElapsedTime| Statement| ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +|2025-05-09T15:16:01.293+08:00|20250509_071601_00015_1| 1| 0.006|SHOW QUERIES WHERE elapsedtime > 0.003| ++-----------------------------+-----------------------+----------+-----------+--------------------------------------+ +``` + +## 2. 状态设置 + +### 2.1 设置连接的模型 + +**含义**:将当前连接的 sql_dialect 置为树模型/表模型,在树模型和表模型中均可使用该命令。 + +#### 语法: + +```SQL +SET SQL_DIALECT EQ (TABLE | TREE) +``` + +#### 示例: + +```SQL +IoTDB> SET SQL_DIALECT=TREE +IoTDB> SHOW CURRENT_SQL_DIALECT +``` + +执行结果如下: + +```SQL ++-----------------+ +|CurrentSqlDialect| ++-----------------+ +| TREE| ++-----------------+ +``` + +### 2.2 更新配置项 + +**含义**:用于更新配置项,执行完成后会进行配置项的热加载,对于支持热修改的配置项会立即生效。 + +#### 语法: + +```SQL +setConfigurationStatement + : SET CONFIGURATION propertyAssignments (ON INTEGER_VALUE)? + ; + +propertyAssignments + : property (',' property)* + ; + +property + : identifier EQ propertyValue + ; + +propertyValue + : DEFAULT + | expression + ; +``` + +**参数解释**: + +1. **propertyAssignments** + - **含义**:更新的配置列表,由多个 `property` 组成。 + - 可以更新多个配置列表,用逗号分隔。 + - **取值**: + - `DEFAULT`:将配置项恢复为默认值。 + - `expression`:具体的值,必须是一个字符串。 +2. **ON INTEGER_VALUE** + - **含义**:指定要更新配置的节点 ID。 + - **可选性**:可选。如果不指定或指定的值低于 0,则更新所有 ConfigNode 和 DataNode 的配置。 + +#### 示例: + +```SQL +IoTDB> SET CONFIGURATION "a"='1',b='1' ON 1; +``` + +### 2.3 读取手动修改的配置文件 + +**含义**:用于读取手动修改过的配置文件,并对配置项进行热加载,对于支持热修改的配置项会立即生效。 + +#### 语法: + +```SQL +loadConfigurationStatement + : LOAD CONFIGURATION localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **localOrClusterMode** + - **含义**:指定配置热加载的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `LOCAL`:只对客户端直连的 DataNode 进行配置热加载。 + - `CLUSTER`:对集群中所有 DataNode 进行配置热加载。 + +#### 示例: + +```SQL +IoTDB> LOAD CONFIGURATION ON LOCAL; +``` + +### 2.4 设置系统的状态 + +**含义**:用于设置系统的状态。 + +#### 语法: + +```SQL +setSystemStatusStatement + : SET SYSTEM TO (READONLY | RUNNING) localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **RUNNING | READONLY** + - **含义**:指定系统的新状态。 + - **取值**: + - `RUNNING`:将系统设置为运行状态,允许读写操作。 + - `READONLY`:将系统设置为只读状态,只允许读取操作,禁止写入操作。 +2. **localOrClusterMode** + - **含义**:指定状态变更的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `LOCAL`:仅对客户端直连的 DataNode 生效。 + - `CLUSTER`:对集群中所有 DataNode 生效。 + +#### 示例: + +```SQL +IoTDB> SET SYSTEM TO READONLY ON CLUSTER; +``` + + +## 3. 数据管理 + +### 3.1 刷写内存表中的数据到磁盘 + +**含义**:将内存表中的数据刷写到磁盘上。 + +#### 语法: + +```SQL +flushStatement + : FLUSH identifier? (',' identifier)* booleanValue? localOrClusterMode? + ; + +booleanValue + : TRUE | FALSE + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **identifier** + - **含义**:指定要刷写的路径名称。 + - **可选性**:可选。如果不指定,则默认刷写所有路径。 + - **多个路径**:可以指定多个路径名称,用逗号分隔。例如:`FLUSH root.ln, root.lnm`。 +2. **booleanValue** + - **含义**:指定刷写的内容。 + - **可选性**:可选。如果不指定,则默认刷写顺序和乱序空间的内存。 + - **取值**: + - `TRUE`:只刷写顺序空间的内存表。 + - `FALSE`:只刷写乱序空间的MemTable。 +3. **localOrClusterMode** + - **含义**:指定刷写的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `ON LOCAL`:只刷写客户端直连的 DataNode 上的内存表。 + - `ON CLUSTER`:刷写集群中所有 DataNode 上的内存表。 + +#### 示例: + +```SQL +IoTDB> FLUSH root.ln TRUE ON LOCAL; +``` + +## 4. 数据修复 + +### 4.1 启动后台扫描并修复 tsfile 任务 + +**含义**:启动一个后台任务,开始扫描并修复 tsfile,能够修复数据文件内的时间戳乱序类异常。 + +#### 语法: + +```SQL +startRepairDataStatement + : START REPAIR DATA localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **localOrClusterMode** + - **含义**:指定数据修复的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `ON LOCAL`:仅对客户端直连的 DataNode 执行。 + - `ON CLUSTER`:对集群中所有 DataNode 执行。 + +#### 示例: + +```SQL +IoTDB> START REPAIR DATA ON CLUSTER; +``` + +### 4.2 暂停后台修复 tsfile 任务 + +**含义**:暂停后台的修复任务,暂停中的任务可通过再次执行 start repair data 命令恢复。 + +#### 语法: + +```SQL +stopRepairDataStatement + : STOP REPAIR DATA localOrClusterMode? + ; + +localOrClusterMode + : (ON (LOCAL | CLUSTER)) + ; +``` + +**参数解释**: + +1. **localOrClusterMode** + - **含义**:指定数据修复的范围。 + - **可选性**:可选。默认值为 `CLUSTER`。 + - **取值**: + - `ON LOCAL`:仅对客户端直连的 DataNode 执行。 + - `ON CLUSTER`:对集群中所有 DataNode 执行。 + +#### 示例: + +```SQL +IoTDB> STOP REPAIR DATA ON CLUSTER; +``` + +## 5. 终止查询 + +### 5.1 主动终止查询 + +**含义**:使用该命令主动地终止查询。 + +#### 语法: + +```SQL +killQueryStatement + : KILL (QUERY queryId=string | ALL QUERIES) + ; +``` + +**参数解释**: + +1. **QUERY queryId=string** + - **含义**:指定要终止的查询的 ID。 `` 是正在执行的查询的唯一标识符。 + - **获取查询 ID**:可以通过 `SHOW QUERIES` 命令获取所有正在执行的查询及其 ID。 +2. **ALL QUERIES** + - **含义**:终止所有正在执行的查询。 + +#### 示例: + +通过指定 `queryId` 可以中止指定的查询,为了获取正在执行的查询 id,用户可以使用 show queries 命令,该命令将显示所有正在执行的查询列表。 + +```SQL +IoTDB> KILL QUERY 20250108_101015_00000_1; -- 终止指定query +IoTDB> KILL ALL QUERIES; -- 终止所有query +``` \ No newline at end of file