Maintenance Statement

1. Status Checking

1.1 Viewing the Cluster Version

Description: Returns the current cluster version.

Syntax:

1. showVersionStatement
2. : SHOW VERSION
3. ;

Example:

1. IoTDB> SHOW VERSION;

Result:

1. +-------+-----------+
2. |Version|  BuildInfo|
3. +-------+-----------+
4. |1.3.4.1|e5334cf-dev|
5. +-------+-----------+

1.2 Viewing Cluster Key Parameters

Description: Returns key parameters of the current cluster.

Syntax:

1. showVariablesStatement
2. : SHOW VARIABLES
3. ;

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:

1. IoTDB> SHOW VARIABLES;

Result:

1. +----------------------------------+-----------------------------------------------------------------+
2. |                          Variable|                                                            Value|
3. +----------------------------------+-----------------------------------------------------------------+
4. |                       ClusterName|                                                   defaultCluster|
5. |             DataReplicationFactor|                                                                1|
6. |           SchemaReplicationFactor|                                                                1|
7. |  DataRegionConsensusProtocolClass|                      org.apache.iotdb.consensus.iot.IoTConsensus|
8. |SchemaRegionConsensusProtocolClass|                  org.apache.iotdb.consensus.ratis.RatisConsensus|
9. |  ConfigNodeConsensusProtocolClass|                  org.apache.iotdb.consensus.ratis.RatisConsensus|
10. |               TimePartitionOrigin|                                                                0|
11. |             TimePartitionInterval|                                                        604800000|
12. |              ReadConsistencyLevel|                                                           strong|
13. |           SchemaRegionPerDataNode|                                                                1|
14. |             DataRegionPerDataNode|                                                                0|
15. |                     SeriesSlotNum|                                                             1000|
16. |           SeriesSlotExecutorClass|org.apache.iotdb.commons.partition.executor.hash.BKDRHashExecutor|
17. |         DiskSpaceWarningThreshold|                                                             0.05|
18. |                TimestampPrecision|                                                               ms|
19. +----------------------------------+-----------------------------------------------------------------+

1.3 Viewing the Current Timestamp of Database

Description: Returns the current timestamp of the database.

Syntax:

1. showCurrentTimestampStatement
2. : SHOW CURRENT_TIMESTAMP
3. ;

Example:

1. IoTDB> SHOW CURRENT_TIMESTAMP;

Result:

1. +-----------------------------+
2. |             CurrentTimestamp|
3. +-----------------------------+
4. |2025-02-17T11:11:52.987+08:00|
5. +-----------------------------+

1.4 Viewing Executing Queries

Description: Displays information about all currently executing queries.

Syntax:

1. showQueriesStatement
2. : SHOW (QUERIES | QUERY PROCESSLIST)
3. (WHERE where=booleanExpression)?
4. (ORDER BY sortItem (',' sortItem)*)?
5. limitOffsetClause
6. ;

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.
  4. Format: LIMIT <offset>, <row_count>.

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:

1. IoTDB> SHOW QUERIES WHERE elapsedtime > 0.003

Result:

1. +-----------------------------+-----------------------+----------+-----------+--------------------------------------+
2. |                         Time|                QueryId|DataNodeId|ElapsedTime|                             Statement|
3. +-----------------------------+-----------------------+----------+-----------+--------------------------------------+
4. |2025-05-09T15:16:01.293+08:00|20250509_071601_00015_1|         1|      0.006|SHOW QUERIES WHERE elapsedtime > 0.003|
5. +-----------------------------+-----------------------+----------+-----------+--------------------------------------+

1.5 Viewing Region Information

Description: Displays regions’ information of the current cluster.

Syntax:

1. showRegionsStatement
2. : SHOW REGIONS
3. ;

Example:

1. IoTDB> SHOW REGIONS

Result:

1. +--------+------------+-------+-------------+-------------+-----------+----------+----------+-------+---------------+------+-----------------------+----------+
2. |RegionId|        Type| Status|     Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|InternalAddress|  Role|             CreateTime|TsFileSize|
3. +--------+------------+-------+-------------+-------------+-----------+----------+----------+-------+---------------+------+-----------------------+----------+
4. |       9|SchemaRegion|Running|root.__system|           21|          0|         1|   0.0.0.0|   6667|      127.0.0.1|Leader|2025-08-01T17:37:01.555|          |
5. |      10|  DataRegion|Running|root.__system|           21|         21|         1|   0.0.0.0|   6667|      127.0.0.1|Leader|2025-08-01T17:37:01.556|   8.27 KB|
6. |      65|SchemaRegion|Running|      root.ln|            1|          0|         1|   0.0.0.0|   6667|      127.0.0.1|Leader|2025-08-25T14:46:50.113|          |
7. |      66|  DataRegion|Running|      root.ln|            1|          1|         1|   0.0.0.0|   6667|      127.0.0.1|Leader|2025-08-25T14:46:50.425|     524 B|
8. +--------+------------+-------+-------------+-------------+-----------+----------+----------+-------+---------------+------+-----------------------+----------+

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:

1. setConfigurationStatement
2. : SET CONFIGURATION propertyAssignments (ON INTEGER_VALUE)?
3. ;

5. propertyAssignments
6. : property (',' property)*
7. ;

9. property
10. : identifier EQ propertyValue
11. ;

13. propertyValue
14. : DEFAULT
15. | expression
16. ;

Parameters:

  1. propertyAssignments: A list of properties to update.
  2. Format: property (',' property)*.
  3. Values:
    • DEFAULT: Resets the configuration to its default value.
    • expression: A specific value (must be a string).
  4. ON INTEGER_VALUE (Optional): Specifies the node ID to update.
  5. If not specified or set to a negative value, updates all ConfigNodes and DataNodes.

Example:

1. IoTDB> SET CONFIGURATION ‘disk_space_warning_threshold’='0.05',‘heartbeat_interval_in_ms’='1000' 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:

1. loadConfigurationStatement
2. : LOAD CONFIGURATION localOrClusterMode?
3. ;

5. localOrClusterMode
6. : (ON (LOCAL | CLUSTER))
7. ;

Parameters:

  1. localOrClusterMode (Optional):
  2. Specifies the scope of configuration loading.
  3. Default: CLUSTER.
  4. Values:
    • LOCAL: Loads configuration only on the DataNode directly connected to the client.
    • CLUSTER: Loads configuration on all DataNodes in the cluster.

Example:

1. IoTDB> LOAD CONFIGURATION ON LOCAL;

2.3 Setting the System Status

Description: Sets the system status to either READONLY or RUNNING.

Syntax:

1. setSystemStatusStatement
2. : SET SYSTEM TO (READONLY | RUNNING) localOrClusterMode?
3. ;

5. localOrClusterMode
6. : (ON (LOCAL | CLUSTER))
7. ;

Parameters:

  1. RUNNING | READONLY:
  2. RUNNING: Sets the system to running mode, allowing both read and write operations.
  3. READONLY: Sets the system to read-only mode, allowing only read operations and prohibiting writes.
  4. localOrClusterMode (Optional):
  5. LOCAL: Applies the status change only to the DataNode directly connected to the client.
  6. CLUSTER: Applies the status change to all DataNodes in the cluster.
  7. Default: ON CLUSTER.

Example:

1. 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:

1. flushStatement
2. : FLUSH identifier? (',' identifier)* booleanValue? localOrClusterMode?
3. ;

5. booleanValue
6. : TRUE | FALSE
7. ;

9. localOrClusterMode
10. : (ON (LOCAL | CLUSTER))
11. ;

Parameters:

  1. identifier (Optional):
  2. Specifies the name of the path to flush.
  3. If not specified, all path are flushed.
  4. Multiple Paths: Multiple path names can be specified, separated by commas (e.g., FLUSH root.ln, root.lnm.**).
  5. booleanValue (**Optional**):
  6. Specifies the type of data to flush.
  7. TRUE: Flushes only the sequential memory table.
  8. FALSE: Flushes only the unsequential MemTable.
  9. Default: Flushes both sequential and unsequential memory tables.
  10. localOrClusterMode (**Optional**):
  11. ON LOCAL: Flushes only the memory tables on the DataNode directly connected to the client.
  12. ON CLUSTER: Flushes memory tables on all DataNodes in the cluster.
  13. Default: ON CLUSTER.

Example:

1. 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:

1. startRepairDataStatement
2. : START REPAIR DATA localOrClusterMode?
3. ;

5. localOrClusterMode
6. : (ON (LOCAL | CLUSTER))
7. ;

Parameters:

  1. localOrClusterMode(Optional):
  2. ON LOCAL: Executes the repair task only on the DataNode directly connected to the client.
  3. ON CLUSTER: Executes the repair task on all DataNodes in the cluster.
  4. Default: ON CLUSTER.

Example:

1. 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:

1. stopRepairDataStatement
2. : STOP REPAIR DATA localOrClusterMode?
3. ;

5. localOrClusterMode
6. : (ON (LOCAL | CLUSTER))
7. ;

Parameters:

  1. localOrClusterMode (Optional):
  2. ON LOCAL: Executes the pause command only on the DataNode directly connected to the client.
  3. ON CLUSTER: Executes the pause command on all DataNodes in the cluster.
  4. Default: ON CLUSTER.

Example:

1. IoTDB> STOP REPAIR DATA ON CLUSTER;

5. Replica Repair

This function has supported passing in a regionId list since V1.3.6, allowing multiple regions to be processed at one time.

5.1 Manual Expansion

Description: Expand the specified Region to the specified DataNode.

Syntax:

1. extendRegionStatement
2. : EXTEND REGION <region_id>(, <region_id>)* TO <data_node_id>
3. ;

Example:

1. IoTDB> EXTEND REGION 1,2,3 TO 3;

5.2 Manual Capacity Reduction

Description: Remove the specified Region from the specified DataNode.

Note: Manual capacity reduction can only reduce the number of replicas to 1 at most, and cannot be reduced to 0.

Syntax:

1. removeRegionStatement
2. : REMOVE REGION <region_id>(, <region_id>)* FROM <data_node_id>
3. ;

Example:

1. IoTDB> REMOVE REGION 1,2,3 FROM 2;

6. Query Termination

6.1 Terminating Queries

Description: Terminates one or more running queries.

Syntax:

1. killQueryStatement
2. : KILL (QUERY queryId=string | ALL QUERIES)
3. ;

Parameters:

  1. QUERY queryId: Specifies the ID of the query to terminate.

  2. To obtain the queryId, use the SHOW QUERIES command.

  3. ALL QUERIES: Terminates all currently running queries.

Example:

Terminate a specific query:

1. IoTDB> KILL QUERY 20250108_101015_00000_1;

Terminate all queries:

1. IoTDB> KILL ALL QUERIES;