The IoTDB OpsKit is an easy-to-use operation and maintenance tool designed for TimechoDB (Enterprise-grade product based on Apache IoTDB). It helps address the operational and maintenance challenges of multi-node distributed IoTDB deployments by providing functionalities such as cluster deployment, start/stop management, elastic scaling, configuration updates, and data export. With one-click command execution, it simplifies the management of complex database clusters and significantly reduces operational complexity.
This document provides guidance on remotely deploying, configuring, starting, and stopping IoTDB cluster instances using the cluster management tool.
The IoTDB OpsKit requires GLIBC 2.17 or later, which means the minimum supported operating system version is CentOS 7. The target machines for IoTDB deployment must have the following dependencies installed:
If any of these dependencies are missing, please install them manually. The last section of this document provides installation commands for reference.
Note: The IoTDB cluster management tool requires root privileges to execute.
The IoTDB OpsKit is an auxiliary tool for TimechoDB. Please contact Timecho team to obtain the download instructions.
To install:
iotdb-opskit directory and execute:bash install-iotdbctl.sh
This will activate the iotdbctl command in the current shell session. You can verify the installation by checking the deployment prerequisites:
iotdbctl cluster check example
iotdbctl, you can execute commands directly using the absolute path:<iotdbctl absolute path>/sbin/iotdbctl cluster check example
The cluster configuration files are stored in the iotdbctl/config directory as YAML files.
default_cluster.yaml) is provided in the iotdbctl/config directory to assist users in setting up their configurations.The YAML file consists of the following five sections:
global – General settings, such as SSH credentials, installation paths, and JDK configurations.confignode_servers – Configuration settings for ConfigNodes.datanode_servers – Configuration settings for DataNodes.grafana_server – Configuration settings for Grafana monitoring.prometheus_server – Configuration settings for Prometheus monitoring.A sample YAML file (default_cluster.yaml) is included in the iotdbctl/config directory.
Example: Checking default_cluster.yaml
To validate a cluster configuration, execute:
iotdbctl cluster check default_cluster
For a complete list of available commands, refer to the command reference section below.
| Parameter | Description | Mandatory |
|---|---|---|
| iotdb_zip_dir | IoTDB distribution directory. If empty, the package will be downloaded from iotdb_download_url. | NO |
| iotdb_download_url | IoTDB download URL. If iotdb_zip_dir is empty, the package will be retrieved from this address. | NO |
| jdk_tar_dir | Local path to the JDK package for uploading and deployment. | NO |
| jdk_deploy_dir | Remote deployment directory for the JDK. | NO |
| jdk_dir_name | JDK decompression directory name. Default: jdk_iotdb. | NO |
| iotdb_lib_dir | IoTDB library directory (or .zip package for upgrades). Default: commented out. | NO |
| user | SSH login username for deployment. | YES |
| password | SSH password (if omitted, key-based authentication will be used). | NO |
| pkey | SSH private key (used if password is not provided). | NO |
| ssh_port | SSH port number. | YES |
| deploy_dir | IoTDB deployment directory. | YES |
| iotdb_dir_name | IoTDB decompression directory name. Default: iotdb. | NO |
| datanode-env.sh | Corresponds to iotdb/config/datanode-env.sh. If both global and confignode_servers are configured, confignode_servers takes precedence. | NO |
| confignode-env.sh | Corresponds to iotdb/config/confignode-env.sh. If both global and datanode_servers are configured, datanode_servers takes precedence. | NO |
| iotdb-system.properties | Corresponds to <iotdb_path>/config/iotdb-system.properties. | NO |
| cn_internal_address | The inter-node communication address for ConfigNodes. This parameter defines the address of the surviving ConfigNode, which defaults to confignode_x. If both global and confignode_servers are configured, the value in confignode_servers takes precedence. Corresponds to cn_internal_address in iotdb/config/iotdb-system.properties. | YES |
| dn_internal_address | The inter-node communication address for DataNodes. This address defaults to confignode_x. If both global and datanode_servers are configured, the value in datanode_servers takes precedence. Corresponds to dn_internal_address in iotdb/config/iotdb-system.properties. | YES |
Both datanode-env.sh and confignode-env.sh allow extra parameters to be appended. These parameters can be configured using the extra_opts field. Example from default_cluster.yaml:
datanode-env.sh: extra_opts: | IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:+UseG1GC" IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:MaxGCPauseMillis=200"
ConfigNodes can be configured in confignode_servers. Multiple ConfigNodes can be deployed, with the first started ConfigNode (node1) serving as the Seed ConfigNode by default.
| Parameter | Description | Mandatory |
|---|---|---|
| name | ConfigNode name. | YES |
| deploy_dir | ConfigNode deployment directory. | YES |
| cn_internal_address | Inter-node communication address for ConfigNodes, corresponding to iotdb/config/iotdb-system.properties. | YES |
| cn_seed_config_node | The cluster configuration address points to the surviving ConfigNode. This address defaults to confignode_x. If both global and confignode_servers are configured, the value in confignode_servers takes precedence, corresponding to cn_internal_address in iotdb/config/iotdb-system.properties | YES |
| cn_internal_port | Internal communication port, corresponding to cn_internal_port in iotdb/config/iotdb-system.properties. | YES |
| cn_consensus_port | Consensus communication port, corresponding to cn_consensus_port in iotdb/config/iotdb-system.properties. | NO |
| cn_data_dir | Data directory for ConfigNodes, corresponding to cn_data_dir in iotdb/config/iotdb-system.properties. | YES |
| iotdb-system.properties | ConfigNode properties file. If global and confignode_servers are both configured, values from confignode_servers take precedence. | NO |
Datanodes can be configured in datanode_servers. Multiple DataNodes can be deployed, each requiring unique configuration.
| Parameter | Description | Mandatory |
|---|---|---|
| name | DataNode name. | YES |
| deploy_dir | DataNode deployment directory. | YES |
| dn_rpc_address | RPC communication address, corresponding to dn_rpc_address in iotdb/config/iotdb-system.properties. | YES |
| dn_internal_address | Internal communication address, corresponding to dn_internal_address in iotdb/config/iotdb-system.properties. | YES |
| dn_seed_config_node | Points to the active ConfigNode. Defaults to confignode_x. If global and datanode_servers are both configured, values from datanode_servers take precedence. Corresponds to dn_seed_config_node in iotdb/config/iotdb-system.properties. | YES |
| dn_rpc_port | RPC port for DataNodes, corresponding to dn_rpc_port in iotdb/config/iotdb-system.properties. | YES |
| dn_internal_port | Internal communication port, corresponding to dn_internal_port in iotdb/config/iotdb-system.properties. | YES |
| iotdb-system.properties | DataNode properties file. If global and datanode_servers are both configured, values from datanode_servers take precedence. | NO |
Grafana can be configured in grafana_server. Defines the settings for deploying Grafana as a monitoring solution for IoTDB.
| Parameter | Description | Mandatory |
|---|---|---|
| grafana_dir_name | Name of the Grafana decompression directory. Default: grafana_iotdb. | NO |
| host | The IP address of the machine hosting Grafana. | YES |
| grafana_port | The port Grafana listens on. Default: 3000. | NO |
| deploy_dir | Deployment directory for Grafana. | YES |
| grafana_tar_dir | Path to the Grafana compressed package. | YES |
| dashboards | Path to pre-configured Grafana dashboards. | NO |
Grafana can be configured in prometheus_server. Defines the settings for deploying Prometheus as a monitoring solution for IoTDB.
| Parameter | Description | Mandatory |
|---|---|---|
| prometheus_dir_name | Name of the Prometheus decompression directory. Default: prometheus_iotdb. | NO |
| host | The IP address of the machine hosting Prometheus. | YES |
| prometheus_port | The port Prometheus listens on. Default: 9090. | NO |
| deploy_dir | Deployment directory for Prometheus. | YES |
| prometheus_tar_dir | Path to the Prometheus compressed package. | YES |
| storage_tsdb_retention_time | Number of days data is retained. Default: 15 days. | NO |
| storage_tsdb_retention_size | Maximum data storage size per block. Default: 512M. Units: KB, MB, GB, TB, PB, EB. | NO |
If metrics are enabled in iotdb-system.properties (in config/xxx.yaml), the configurations will be automatically applied to Prometheus without manual modification.
Special Configuration Notes
:), it is recommended to enclose the entire value in double quotes ("").This operation deletes cluster data directories, including:
cn_system_dir, cn_consensus_dir),dn_data_dirs, dn_consensus_dir, dn_system_dir),To clean cluster data, perform the following steps:
# Step 1: Stop the cluster iotdbctl cluster stop default_cluster # Step 2: Clean the cluster data iotdbctl cluster clean default_cluster
The cluster destruction process completely removes the following resources:
cn_system_dir, cn_consensus_dir),dn_data_dirs, dn_consensus_dir, dn_system_dir),To destroy a cluster, follow these steps:
# Step 1: Stop the cluster iotdbctl cluster stop default_cluster # Step 2: Destroy the cluster iotdbctl cluster destroy default_cluster
To upgrade the cluster, follow these steps:
config/xxx.yaml, set iotdb_lib_dir to the path of the JAR files to be uploaded. Example: iotdb/libiotdb/lib directory:zip -r lib.zip apache-iotdb-1.2.0/lib/*
iotdbctl cluster dist-lib default_cluster iotdbctl cluster restart default_cluster
Hot deployment allows real-time configuration updates without restarting the cluster.
Steps:
config/xxx.yaml.iotdbctl cluster dist-conf default_cluster iotdbctl cluster reload default_cluster
To expand the cluster by adding new nodes:
config/xxx.yaml.iotdbctl cluster scaleout default_cluster
To remove a node from the cluster:
config/xxx.yaml:cn_internal_portrpc_portiotdbctl cluster scalein default_cluster
To manage an existing IoTDB cluster with the OpsKit tool:
user, password (or pkey), and ssh_port in config/xxx.yaml./home/data/apache-iotdb-1.1.1:deploy_dir: /home/data/ iotdb_dir_name: apache-iotdb-1.1.1
JAVA_HOME is not used, set the JDK deployment path:jdk_deploy_dir: /home/data/ jdk_dir_name: jdk_1.8.2
cn_internal_address and dn_internal_addressconfignode_servers → iotdb-system.properties, configure:cn_internal_address, cn_internal_port, cn_consensus_port, cn_system_dir, cn_consensus_dirdatanode_servers → iotdb-system.properties, configure:dn_rpc_address, dn_internal_address, dn_data_dirs, dn_consensus_dir, dn_system_diriotdbctl cluster init default_cluster
To deploy an IoTDB cluster along with Grafana and Prometheus:
iotdb-system.properties, enable the metrics interface.iotdbctl cluster start default_cluster
For detailed parameters, refer to the Cluster Configuration Files section above.
The basic command structure is:
iotdbctl cluster <key> <cluster name> [params (Optional)]
key – The specific command to execute.cluster_name – The name of the cluster (matches the YAML file name in iotdbctl/config).params – Optional parameters for the command.Example: Deploying the default_cluster cluster
iotdbctl cluster deploy default_cluster
| ommand | escription | Parameters |
|---|---|---|
| check | Check cluster readiness for deployment. | Cluster name |
| clean | Clean up cluster data. | Cluster name |
| deploy/dist-all | Deploy the cluster. | Cluster name, -N module (optional: iotdb, grafana, prometheus), -op force (optional) |
| list | List cluster status. | None |
| start | Start the cluster. | Cluster name, -N node name (optional: iotdb, grafana, prometheus) |
| stop | Stop the cluster. | Cluster name, -N node name (optional), -op force (optional) |
| restart | Restart the cluster. | Cluster name, -N node name (optional), -op force (optional) |
| show | View cluster details. | Cluster name, details (optional) |
| destroy | Destroy the cluster. | Cluster name, -N module (optional: iotdb, grafana, prometheus) |
| scaleout | Expand the cluster. | Cluster name |
| scalein | Shrink the cluster. | Cluster name, -N node name or IP:port |
| reload | Hot reload cluster configuration. | Cluster name |
| dist-conf | Distribute cluster configuration. | Cluster name |
| dumplog | Backup cluster logs. | Cluster name, -N node name, -h target IP, -pw target password, -p target port, -path backup path, -startdate, -enddate, -loglevel, -l transfer speed |
| dumpdata | Backup cluster data | Cluster name, -h target IP, -pw target password, -p target port, -path backup path, -startdate, -enddate, -l transfer speed |
| dist-lib | Upgrade the IoTDB lib package. | Cluster name |
| init | Initialize the cluster configuration. | Cluster name |
| status | View process status. | Cluster name |
| activate | Activate the cluster. | Cluster name |
| health_check | Perform a health check. | Cluster name, -N, nodename (optional) |
| backup | Backup the cluster. | Cluster name,-N nodename (optional) |
| importschema | Import metadata. | Cluster name,-N nodename -param paramters |
| exportschema | Export metadata. | Cluster name,-N nodename -param paramters |
The following examples use default_cluster.yaml as a reference. Users can modify the commands according to their specific cluster configuration files.
The following command checks whether the cluster environment meets the deployment requirements:
iotdbctl cluster check default_cluster
Execution Steps:
default_cluster.yaml) based on the cluster name.confignode_servers and datanode_servers).Expected Output:
Info: example check successfully!Error: example check fail!Troubleshooting Tips:
jdk1.8+ path in the YAML file for deployment.Error: Server (ip:172.20.31.76) iotdb port (10713) is listening.Deploy the entire cluster using the following command:
iotdbctl cluster deploy default_cluster
Execution Steps:
YAML file based on the cluster name.jdk_tar_dir and jdk_deploy_dir are configured).Force Deployment: To overwrite existing deployment directories and redeploy:
iotdbctl cluster deploy default_cluster -op force
Deploying Individual Modules:
You can deploy specific components individually:
# Deploy Grafana module iotdbctl cluster deploy default_cluster -N grafana # Deploy Prometheus module iotdbctl cluster deploy default_cluster -N prometheus # Deploy IoTDB module iotdbctl cluster deploy default_cluster -N iotdb
Start the cluster using the following command:
iotdbctl cluster start default_cluster
Execution Steps:
YAML file based on the cluster name.Start a Single Node: Start specific nodes by name or IP:
# By node name iotdbctl cluster start default_cluster -N datanode_1 # By IP and port (ConfigNode uses `cn_internal_port`, DataNode uses `rpc_port`) iotdbctl cluster start default_cluster -N 192.168.1.5:6667 # Start Grafana iotdbctl cluster start default_cluster -N grafana # Start Prometheus iotdbctl cluster start default_cluster -N prometheus
Note: The iotdbctl tool relies on start-confignode.sh and start-datanode.sh scripts. If startup fails, check the cluster status using the following command:
iotdbctl cluster status default_cluster
To view the current cluster status:
iotdbctl cluster show default_cluster
To view detailed information:
iotdbctl cluster show default_cluster details
Execution Steps:
confignode_servers and datanode_servers configuration.show cluster details via CLI.To stop the entire cluster:
iotdbctl cluster stop default_cluster
Execution Steps:
confignode_servers and datanode_servers configuration.Force Stop: To forcibly stop the cluster using kill -9:
iotdbctl cluster stop default_cluster -op force
Stop a Single Node: Stop nodes by name or IP:
# By node name iotdbctl cluster stop default_cluster -N datanode_1 # By IP and port iotdbctl cluster stop default_cluster -N 192.168.1.5:6667 # Stop Grafana iotdbctl cluster stop default_cluster -N grafana # Stop Prometheus iotdbctl cluster stop default_cluster -N prometheus
Note: If the IoTDB cluster is not fully stopped, verify its status using:
iotdbctl cluster status default_cluster
To clean up cluster data, execute:
iotdbctl cluster clean default_cluster
Execution Steps:
YAML file and retrieve confignode_servers and datanode_servers configuration.cn_system_dir, dn_system_dir),cn_consensus_dir, dn_consensus_dir),Restart the cluster using the following command:
iotdbctl cluster restart default_cluster
Execution Steps:
Force Restart: To forcibly restart the cluster:
iotdbctl cluster restart default_cluster -op force
Restart a Single Node: Restart specific nodes by name:
# Restart DataNode iotdbctl cluster restart default_cluster -N datanode_1 # Restart ConfigNode iotdbctl cluster restart default_cluster -N confignode_1 # Restart Grafana iotdbctl cluster restart default_cluster -N grafana # Restart Prometheus iotdbctl cluster restart default_cluster -N prometheus
To add a node to the cluster:
config/xxx.yaml to add a new DataNode or ConfigNode.iotdbctl cluster scaleout default_cluster
Execution Steps:
jdk_tar_dir and jdk_deploy_dir are configured).Tip: Only one node expansion is supported per execution.
To remove a node from the cluster:
config/xxx.yaml.#Scale down by node name iotdbctl cluster scalein default_cluster -N nodename #Scale down according to ip+port (ip+port obtains the only node according to ip+dn_rpc_port in datanode, and obtains the only node according to ip+cn_internal_port in confignode) iotdbctl cluster scalein default_cluster -N ip:port
Execution Steps:
Tip: Only one node shrinking is supported per execution.
To destroy the entire cluster:
iotdbctl cluster destroy default_cluster
Execution Steps:
Destroy a Single Module: To destroy individual modules:
# Destroy Grafana iotdbctl cluster destroy default_cluster -N grafana # Destroy Prometheus iotdbctl cluster destroy default_cluster -N prometheus # Destroy IoTDB iotdbctl cluster destroy default_cluster -N iotdb
To distribute the cluster configuration files across nodes:
iotdbctl cluster dist-conf default_cluster
Execution Steps:
cluster-name.confignode_servers, datanode_servers, grafana, and prometheus.iotdb-system.properties to the specified nodes.To reload the cluster configuration without restarting:
iotdbctl cluster reload default_cluster
Execution Steps:
cluster-name.load configuration command through the CLI for each node.To back up logs from specific nodes:
iotdbctl cluster dumplog default_cluster -N datanode_1,confignode_1 -startdate '2023-04-11' -enddate '2023-04-26' -h 192.168.9.48 -p 36000 -u root -pw root -path '/iotdb/logs' -logs '/root/data/db/iotdb/logs'
Execution Steps:
cluster-name.datanode_1 and confignode_1)./iotdb/logs or the default IoTDB installation path.| Command | Description | Mandatory |
|---|---|---|
| -h | IP address of the backup server | NO |
| -u | Username for the backup server | NO |
| -pw | Password for the backup server | NO |
| -p | Backup server port (Default: 22) | NO |
| -path | Path for backup data (Default: current path) | NO |
| -loglevel | Log level (all, info, error, warn. Default: all) | NO |
| -l | Speed limit (Default: unlimited; Range: 0 to 104857601 Kbit/s) | NO |
| -N | Cluster names (comma-separated) | YES |
| -startdate | Start date (inclusive; Default: 1970-01-01) | NO |
| -enddate | End date (inclusive) | NO |
| -logs | IoTDB log storage path (Default: {iotdb}/logs) | NO |
To back up data from the cluster:
iotdbctl cluster dumpdata default_cluster -granularity partition -startdate '2023-04-11' -enddate '2023-04-26' -h 192.168.9.48 -p 36000 -u root -pw root -path '/iotdb/datas'
This command identifies the leader node from the YAML file and backs up data within the specified date range to the /iotdb/datas directory on the 192.168.9.48 server.
| Command | Description | Mandatory |
|---|---|---|
| -h | IP address of the backup server | NO |
| -u | Username for the backup server | NO |
| -pw | Password for the backup server | NO |
| -p | Backup server port (Default: 22) | NO |
| -path | Path for storing backup data (Default: current path) | NO |
| -granularity | Data partition granularity | YES |
| -l | Speed limit (Default: unlimited; Range: 0 to 104857601 Kbit/s) | NO |
| -startdate | Start date (inclusive) | YES |
| -enddate | End date (inclusive) | YES |
To upgrade the cluster:
iotdbctl cluster dist-lib default_cluster
Execution Steps:
confignode_servers and datanode_servers.Note: After the upgrade, restart all IoTDB nodes for the changes to take effect.
To initialize the cluster:
iotdbctl cluster init default_cluster
Execution Steps:
confignode_servers, datanode_servers, Grafana, and Prometheus.To check the cluster process status:
iotdbctl cluster status default_cluster
Execution Steps:
confignode_servers, datanode_servers, Grafana, and Prometheus.Default Activation Method: To activate the cluster using an activation code:
iotdbctl cluster activate default_cluster
Execution Steps:
confignode_servers configuration.Example:
Machine code: Kt8NfGP73FbM8g4Vty+V9qU5lgLvwqHEF3KbLN/SGWYCJ61eFRKtqy7RS/jw03lHXt4MwdidrZJ== JHQpXu97IKwv3rzbaDwoPLUuzNCm5aEeC9ZEBW8ndKgGXEGzMms25+u== Please enter the activation code: JHQpXu97IKwv3rzbaDwoPLUuzNCm5aEeC9ZEBW8ndKg=, lTF1Dur1AElXIi/5jPV9h0XCm8ziPd9/R+tMYLsze1oAPxE87+Nwws= Activation successful.
Activate a Specific Node: To activate a specific node:
iotdbctl cluster activate default_cluster -N confignode1
Activate via License Path: To activate using a license file:
iotdbctl cluster activate default_cluster -op license_path
To perform a cluster health check:
iotdbctl cluster health_check default_cluster
Execution Steps:
confignode_servers and datanode_servers.health_check.sh on each node.Single Node Health Check: To check a specific node:
iotdbctl cluster health_check default_cluster -N datanode_1
To back up the cluster during shutdown:
iotdbctl cluster backup default_cluster
Execution Steps:
confignode_servers and datanode_servers.backup.sh on each node.Single Node Backup: To back up a specific node:
iotdbctl cluster backup default_cluster -N datanode_1
Note: Multi-node deployment on a single machine only supports quick mode.
To import metadata:
iotdbctl cluster importschema default_cluster -N datanode1 -param "-s ./dump0.csv -fd ./failed/ -lpf 10000"
Execution Steps:
datanode_servers configuration information.import-schema.sh on datanode1.Parameter Descriptions for -param:
| Command | Description | Mandatory |
|---|---|---|
| -s | Specify the data file or directory to be imported. If a directory is specified, all files with a .csv extension will be imported in bulk. | YES |
| -fd | Specify a directory to store failed import files. If omitted, failed files will be saved in the source directory with the .failed suffix added to the original filename. | No |
| -lpf | Specify the maximum number of lines per failed import file (Default: 10,000). | NO |
To export metadata:
iotdbctl cluster exportschema default_cluster -N datanode1 -param "-t ./ -pf ./pattern.txt -lpf 10 -t 10000"
Execution Steps:
datanode_servers configuration information.export-schema.sh on datanode1.Parameter Descriptions for -param:
| Command | Description | Mandatory |
|---|---|---|
| -t | Specify the output path for the exported CSV file. | YES |
| -path | Specify the metadata path pattern for export. If this parameter is specified, the -s parameter will be ignored. Example: root.stock.**. | NO |
| -pf | If -path is not specified, use this parameter to specify the file containing metadata paths to export. The file must be in .txt format, with one path per line. | NO |
| -lpf | Specify the maximum number of lines per exported file (Default: 10,000). | NO |
| -timeout | Specify the session query timeout in milliseconds. | NO |
In the cluster deployment tool installation directory (config/example), there are three YAML configuration examples. If needed, you can copy and modify them for your deployment.
| Name | Description |
|---|---|
| default_1c1d.yaml | Example configuration for 1 ConfigNode and 1 DataNode. |
| default_3c3d.yaml | Example configuration for 3 ConfigNodes and 3 DataNodes. |
| default_3c3d_grafa_prome | Example configuration for 3 ConfigNodes, 3 DataNodes, Grafana, and Prometheus. |
The IoTDB Data Directory Overview Tool provides an overview of the IoTDB data directory structure. It is located at tools/tsfile/print-iotdb-data-dir.
.\print-iotdb-data-dir.bat <IoTDB data folder path, separated by commas if there are multiple folders> (<storage path of the output overview file>)
./print-iotdb-data-dir.sh <IoTDB data folder path, separated by commas if there are multiple folders> (<storage path of the output overview file>)
Note: If the output path is not specified, the default relative path IoTDB_data_dir_overview.txt will be used.
Use Windows in this example:
.\print-iotdb-data-dir.bat D:\github\master\iotdb\data\datanode\data ```````````````````````` Starting Printing the IoTDB Data Directory Overview ```````````````````````` output save path:IoTDB_data_dir_overview.txt data dir num:1 143 [main] WARN o.a.i.t.c.conf.TSFileDescriptor - not found iotdb-system.properties, use the default configs. |============================================================== |D:\github\master\iotdb\data\datanode\data |--sequence | |--root.redirect0 | | |--1 | | | |--0 | |--root.redirect1 | | |--2 | | | |--0 | |--root.redirect2 | | |--3 | | | |--0 | |--root.redirect3 | | |--4 | | | |--0 | |--root.redirect4 | | |--5 | | | |--0 | |--root.redirect5 | | |--6 | | | |--0 | |--root.sg1 | | |--0 | | | |--0 | | | |--2760 |--unsequence |==============================================================
The TsFile Sketch Tool provides a summarized view of the content within a TsFile. It is located at tools/tsfile/print-tsfile.
.\print-tsfile-sketch.bat <TsFile path> (<storage path of the output sketch file>)
./print-tsfile-sketch.sh <TsFile path> (<storage path of the output sketch file>)
Note: If the output path is not specified, the default relative path TsFile_sketch_view.txt will be used.
Use Windows in this example:
.\print-tsfile.bat D:\github\master\1669359533965-1-0-0.tsfile D:\github\master\sketch.txt ```````````````````````` Starting Printing the TsFile Sketch ```````````````````````` TsFile path:D:\github\master\1669359533965-1-0-0.tsfile Sketch save path:D:\github\master\sketch.txt 148 [main] WARN o.a.i.t.c.conf.TSFileDescriptor - not found iotdb-system.properties, use the default configs. -------------------------------- TsFile Sketch -------------------------------- file path: D:\github\master\1669359533965-1-0-0.tsfile file length: 2974 POSITION| CONTENT -------- ------- 0| [magic head] TsFile 6| [version number] 3 ||||||||||||||||||||| [Chunk Group] of root.sg1.d1, num of Chunks:3 7| [Chunk Group Header] | [marker] 0 | [deviceID] root.sg1.d1 20| [Chunk] of root.sg1.d1.s1, startTime: 1669359533948 endTime: 1669359534047 count: 100 [minValue:-9032452783138882770,maxValue:9117677033041335123,firstValue:7068645577795875906,lastValue:-5833792328174747265,sumValue:5.795959009889246E19] | [chunk header] marker=5, measurementID=s1, dataSize=864, dataType=INT64, compressionType=SNAPPY, encodingType=RLE | [page] UncompressedSize:862, CompressedSize:860 893| [Chunk] of root.sg1.d1.s2, startTime: 1669359533948 endTime: 1669359534047 count: 100 [minValue:-8806861312244965718,maxValue:9192550740609853234,firstValue:1150295375739457693,lastValue:-2839553973758938646,sumValue:8.2822564314572677E18] | [chunk header] marker=5, measurementID=s2, dataSize=864, dataType=INT64, compressionType=SNAPPY, encodingType=RLE | [page] UncompressedSize:862, CompressedSize:860 1766| [Chunk] of root.sg1.d1.s3, startTime: 1669359533948 endTime: 1669359534047 count: 100 [minValue:-9076669333460323191,maxValue:9175278522960949594,firstValue:2537897870994797700,lastValue:7194625271253769397,sumValue:-2.126008424849926E19] | [chunk header] marker=5, measurementID=s3, dataSize=864, dataType=INT64, compressionType=SNAPPY, encodingType=RLE | [page] UncompressedSize:862, CompressedSize:860 ||||||||||||||||||||| [Chunk Group] of root.sg1.d1 ends 2656| [marker] 2 2657| [TimeseriesIndex] of root.sg1.d1.s1, tsDataType:INT64, startTime: 1669359533948 endTime: 1669359534047 count: 100 [minValue:-9032452783138882770,maxValue:9117677033041335123,firstValue:7068645577795875906,lastValue:-5833792328174747265,sumValue:5.795959009889246E19] | [ChunkIndex] offset=20 2728| [TimeseriesIndex] of root.sg1.d1.s2, tsDataType:INT64, startTime: 1669359533948 endTime: 1669359534047 count: 100 [minValue:-8806861312244965718,maxValue:9192550740609853234,firstValue:1150295375739457693,lastValue:-2839553973758938646,sumValue:8.2822564314572677E18] | [ChunkIndex] offset=893 2799| [TimeseriesIndex] of root.sg1.d1.s3, tsDataType:INT64, startTime: 1669359533948 endTime: 1669359534047 count: 100 [minValue:-9076669333460323191,maxValue:9175278522960949594,firstValue:2537897870994797700,lastValue:7194625271253769397,sumValue:-2.126008424849926E19] | [ChunkIndex] offset=1766 2870| [IndexOfTimerseriesIndex Node] type=LEAF_MEASUREMENT | <s1, 2657> | <endOffset, 2870> ||||||||||||||||||||| [TsFileMetadata] begins 2891| [IndexOfTimerseriesIndex Node] type=LEAF_DEVICE | <root.sg1.d1, 2870> | <endOffset, 2891> | [meta offset] 2656 | [bloom filter] bit vector byte array length=31, filterSize=256, hashFunctionSize=5 ||||||||||||||||||||| [TsFileMetadata] ends 2964| [TsFileMetadataSize] 73 2968| [magic tail] TsFile 2974| END of TsFile ---------------------------- IndexOfTimerseriesIndex Tree ----------------------------- [MetadataIndex:LEAF_DEVICE] └──────[root.sg1.d1,2870] [MetadataIndex:LEAF_MEASUREMENT] └──────[s1,2657] ---------------------------------- TsFile Sketch End ----------------------------------
Explanations:
| symbol. The left side indicates the actual position within the TsFile, while the right side provides a summary of the content."||||||||||||||||||||" lines are added for readability and are not part of the actual TsFile data."IndexOfTimerseriesIndex Tree" section reorganizes the metadata index tree at the end of the TsFile. This view aids understanding but does not represent actual stored data.The TsFile Resource Sketch Tool displays details about TsFile resource files. It is located at tools/tsfile/print-tsfile-resource-files.
.\print-tsfile-resource-files.bat <path of the parent directory of the TsFile resource files, or path of a TsFile resource file>
./print-tsfile-resource-files.sh <path of the parent directory of the TsFile resource files, or path of a TsFile resource file>
Use Windows in this example:
.\print-tsfile-resource-files.bat D:\github\master\iotdb\data\datanode\data\sequence\root.sg1\0\0 ```````````````````````` Starting Printing the TsFileResources ```````````````````````` 147 [main] WARN o.a.i.t.c.conf.TSFileDescriptor - not found iotdb-system.properties, use the default configs. 230 [main] WARN o.a.iotdb.db.conf.IoTDBDescriptor - Cannot find IOTDB_HOME or IOTDB_CONF environment variable when loading config file iotdb-system.properties, use default configuration 231 [main] WARN o.a.iotdb.db.conf.IoTDBDescriptor - Couldn't load the configuration iotdb-system.properties from any of the known sources. 233 [main] WARN o.a.iotdb.db.conf.IoTDBDescriptor - Cannot find IOTDB_HOME or IOTDB_CONF environment variable when loading config file iotdb-system.properties, use default configuration 237 [main] WARN o.a.iotdb.db.conf.IoTDBDescriptor - Couldn't load the configuration iotdb-system.properties from any of the known sources. Analyzing D:\github\master\iotdb\data\datanode\data\sequence\root.sg1\0\0\1669359533489-1-0-0.tsfile ... Resource plan index range [9223372036854775807, -9223372036854775808] device root.sg1.d1, start time 0 (1970-01-01T08:00+08:00[GMT+08:00]), end time 99 (1970-01-01T08:00:00.099+08:00[GMT+08:00]) Analyzing the resource file folder D:\github\master\iotdb\data\datanode\data\sequence\root.sg1\0\0 finished. .\print-tsfile-resource-files.bat D:\github\master\iotdb\data\datanode\data\sequence\root.sg1\0\0\1669359533489-1-0-0.tsfile.resource ```````````````````````` Starting Printing the TsFileResources ```````````````````````` 178 [main] WARN o.a.iotdb.db.conf.IoTDBDescriptor - Cannot find IOTDB_HOME or IOTDB_CONF environment variable when loading config file iotdb-system.properties, use default configuration 186 [main] WARN o.a.i.t.c.conf.TSFileDescriptor - not found iotdb-system.properties, use the default configs. 187 [main] WARN o.a.iotdb.db.conf.IoTDBDescriptor - Couldn't load the configuration iotdb-system.properties from any of the known sources. 188 [main] WARN o.a.iotdb.db.conf.IoTDBDescriptor - Cannot find IOTDB_HOME or IOTDB_CONF environment variable when loading config file iotdb-system.properties, use default configuration 192 [main] WARN o.a.iotdb.db.conf.IoTDBDescriptor - Couldn't load the configuration iotdb-system.properties from any of the known sources. Analyzing D:\github\master\iotdb\data\datanode\data\sequence\root.sg1\0\0\1669359533489-1-0-0.tsfile ... Resource plan index range [9223372036854775807, -9223372036854775808] device root.sg1.d1, start time 0 (1970-01-01T08:00+08:00[GMT+08:00]), end time 99 (1970-01-01T08:00:00.099+08:00[GMT+08:00]) Analyzing the resource file D:\github\master\iotdb\data\datanode\data\sequence\root.sg1\0\0\1669359533489-1-0-0.tsfile.resource finished.