TSDB for InfluxDB® will be discontinued on October 23, 2026. To prevent service interruptions, migrate your data as soon as possible. This topic describes the data migration solutions for TSDB for InfluxDB®.
For more information about the discontinuation of TSDB for InfluxDB®, see related notices.
Choose a migration solution
Choose a migration solution based on your business needs:
For a like-for-like migration: Use a self-hosted InfluxDB instance.
For large-scale data that requires a distributed database:
For time series monitoring scenarios: Use LindormTSDB. Note that LindormTSDB is not compatible with the InfluxQL query language. You must modify the query code in your application. If you are able to modify the code, we recommend migrating to LindormTSDB.
For other time series scenarios: Evaluate other distributed time series database solutions.
Migrate from TSDB for InfluxDB® to a self-hosted InfluxDB instance
Prerequisites
Your TSDB for InfluxDB® instance must be upgraded to the latest version (1.8.14).
Backup port 8088 must be enabled.
You can submit a ticket through the Alibaba Cloud ticket system to open the backup port.
The self-hosted InfluxDB instance and the TSDB for InfluxDB® instance must be in the same region, zone, and virtual private cloud (VPC). They must also use the same instance type and be connected to the same virtual switch.
This topic uses an Elastic Compute Service (ECS) environment as an example. Purchase an ECS instance that meets these conditions and install self-hosted InfluxDB V1.8.10. For more information, see Quickly purchase a subscription instance.
To understand the migration process, see the Backup and restore section in the official InfluxDB documentation.
Notes
The backup and recovery process supports only historical data migration. It does not support incremental data migration. Therefore, you must write data to both the TSDB for InfluxDB® instance and the self-hosted InfluxDB instance concurrently before you migrate historical data.
Backups require extra storage space. Ensure that the available storage space is more than twice the size of your data.
If the current memory usage of the instance exceeds 80%, upgrade the instance before you back up and migrate data.
You must back up data by shard. This requires you to specify the database, retention policy, and shard for the backup.
Backup
Run the following command on the ECS instance where your self-hosted InfluxDB is installed.
influxd backup -portable \
-host ts-xxx.influxdata.tsdb.aliyuncs.com:8088 \
-db example_db \
-rp example_rp \
-shard 123 \
/root/tmp/influx_backupParameters:
host: The VPC endpoint of the TSDB for InfluxDB® instance. You can log on to the TSDB console and find the VPC Endpoint on the Instance Details page.
-db: The name of the database to back up. You can find the database name in the TSDB console on the page.
-rp: The name of the retention policy to back up. To find the name, log on to the TSDB console, go to the page, and click Storage Policy Management in the Actions column for the target database.
-shard: The ID of the shard to back up. You can run the
show shardscommand to find the shard ID.The path to the destination folder for the backup files.
Restore data
For instructions, see the official documentation about how to restore the backed-up data to an existing database.
On the ECS instance where your self-hosted InfluxDB is installed, run the following command to restore the data to a temporary database.
influxd restore -portable \ -db example_db \ -rp example_rp \ -shard 123 \ -newdb example_tmp_db \ /root/tmp/influx_backupParameters:
-db: The name of the backed-up database.
-rp: The name of the backed-up retention policy.
-shard: The ID of the backed-up shard.
newdb: The name of the temporary database for the restoration.
The path to the folder that contains the backup files.
Use InfluxQL to query data from the temporary database and write it back to the destination database.
SELECT * INTO "example_db"."example_rp".:MEASUREMENT FROM "example_tmp_db".autogen./.*/ GROUP BY *Delete the temporary database.
DROP DATABASE "example_tmp_db"
Migrate from TSDB for InfluxDB® to another database (including LindormTSDB)
Notes
You must add tag and time filter conditions to your queries. Otherwise, large queries may cause the instance to become unstable.
Export data to a CSV file
You can use the Influx-cli tool (V1.x) to run queries and export the results to a CSV file.
influx -ssl \
-host ts-xxx.influxdata.tsdb.aliyuncs.com \
-port 8086 \
-username "xxx" \
-password "xxx" \
-format "csv" \
-precision ms \
-database example_db \
-execute "select * from sensor" | \
> /root/tmp/ouput.csvThe first column in the exported CSV file is the name column, which represents the measurement. If you do not need this column, run the following command.
influx -ssl \
-host ts-xxx.influxdata.tsdb.aliyuncs.com \
-port 8086 \
-username "xxx" \
-password "xxx" \
-format "csv" \
-precision ms \
-database example_db \
-execute "select * from sensor" | \
sed -r 's/^[^,]+,//' | \
> /root/tmp/ouput.csvImport data to another database
Use open source tools or write a program to import the CSV file into another database. The following sections provide examples.
Example 1: Import data to LindormTSDB
Use the Influx-cli tool (V1.x) to export data from your TSDB for InfluxDB® instance.
Set the precision to ms or rfc3339, and remove the measurement column.
influx -ssl \ -host ts-xxx.influxdata.tsdb.aliyuncs.com \ -port 8086 \ -username "xxx" \ -password "xxx" \ -format "csv" \ -precision ms \ -database example_db \ -execute "select * from sensor" | \ sed -r 's/^[^,]+,//' | \ > /root/tmp/ouput.csvIn LindormTSDB, create a destination database and table. You must create all fields in advance.
Import the CSV file to the destination table in the destination database by using Lindorm-cli.
lindorm-cli -url jdbc:lindorm:tsdb:url=http://ld-xxx-proxy-tsdb-pub.lindorm.rds.aliyuncs.com:8242 \
-format=csv \
-input /root/tmp/ouput.csv \
-database example_db \
-table example_tableExample 2: Import data to InfluxDB
Download the following tools.
Included in the InfluxDB deployment package: Influx-cli (V1.x)
Separate deployment package: Influx-cli (V2.x)
Use the Influx-cli (V1.x) tool to export data.
Note the following two points:
You do not need to specify the precision.
Keep the measurement column.
influx -ssl \ -host ts-xxx.influxdata.tsdb.aliyuncs.com \ -port 8086 \ -username "xxx" \ -password "xxx" \ -format "csv" \ -database example_db \ -execute "select * from sensor" | \ > /root/tmp/ouput.csv
Use the Influx-cli (V2.x) tool to convert the CSV file to a line protocol file. For more information, see Write CSV data to InfluxDB.
influx write dryrun \ --format csv \ --header "name|measurement,time|dateTime,device_id|tag,humidity|long|0,region|tag,temperature|double|0.0" \ --skipHeader=1 \ -f /root/tmp/ouput.csv \ > /root/tmp/ouput.lineParameters:
header: The format is
column_name|data_type|default_value. For more information, see header format. For details about time types, see Specify the time type.Write the line protocol file to your self-hosted InfluxDB V1.x instance.