All Products
Search
Document Center

Lindorm:Migrate full data from TSDB to LindormTSDB

Last Updated:Mar 28, 2026

When you migrate all time series data from a Time Series Database (TSDB) instance to the Lindorm time series engine (LindormTSDB), use the LindormTSDB migration tool. The tool reads data from TSDB, splits the workload into parallel subtasks, and writes data to LindormTSDB using the multi-value data model.

Note TSDB is no longer available for sale. Alibaba Cloud recommends migrating all data from your TSDB instances to LindormTSDB.

Prerequisites

Before you begin, make sure that you have:

  • A Linux or macOS client with the following installed:

    • Java Development Kit (JDK) 1.8 or later

    • Python 2.x or 3.x

  • A TSDB instance running version 2.7.4 or later

  • A Lindorm instance with LindormTSDB activated. For details, see Create an instance

How the migration tool works

The tool processes data in the following sequence:

  1. Reads all time series data from the TSDB instance and saves it to a local file.

  2. Splits the migration task into time groups based on beginDateTime, endDateTime, and splitIntervalMs. Within each time group, splits the workload into read subtasks based on oidBatch. Each read subtask reads a batch of time series within the specified time range and sends the data to the write component.

  3. After all read subtasks in a time group complete, records the time group ID, migration task ID, and task status in a list named internal_datax_job<jobName>.

  4. The write component receives data from each read subtask and writes it to LindormTSDB using the multi-value data model.

Note A new time group starts only after all read subtasks in the previous time group have completed. The migration supports multiple concurrent tasks, and each task's ID is tracked in the task ID list.

Before you start

Network connectivity

  • Deploy the client, the Lindorm instance, and the TSDB instance in the same Virtual Private Cloud (VPC) to avoid latency and connectivity issues.

  • To migrate over the Internet, enable the public endpoints of both the Lindorm and TSDB instances, and add your client's IP address to the whitelists of both instances. For details, see Configure whitelists.

Performance planning

Assess how the migration may affect your business before you start. Key factors include:

  • TSDB instance specification

  • Specification of the environment (such as an Elastic Compute Service (ECS) instance) running your application

  • Number of time series in the TSDB instance

  • Total data size to migrate

  • Average reporting frequency per time series

  • Time range of the data

  • splitIntervalMs value

See Performance test results for reference throughput numbers by instance size.

Data model and query changes after migration

Be aware of the following data model differences before you migrate:

ItemTSDBLindormTSDBImpact
Timestamp length10 digits (seconds)13 digits (milliseconds)Timestamps are automatically converted to milliseconds after migration
Write modelSingle-valueMulti-valueData written with the single-value model must be queried using multi-value syntax after migration
SQL queriesSupportedNot available for multi-value writesCreate a time series table before migrating if you need SQL queries

Configure the migration task

Save your migration configuration as a JSON file (for example, job.json). The configuration has three sections: task settings, reader (TSDB source), and writer (LindormTSDB destination).

Task settings

ParameterRequiredDescription
channelNoNumber of concurrent tasks. Default: 1.
errorLimitNoNumber of write errors allowed before the task fails. Default: 0.

Reader parameters (TSDB source)

Configure these parameters based on your TSDB instance specification and data volume.

ParameterRequiredDescription
sinkDbTypeYesSet to LINDORM-MIGRATION.
endpointYesTSDB instance endpoint. For details, see Network connection.
beginDateTimeYesStart time of the migration range.
endDateTimeYesEnd time of the migration range.
splitIntervalMsYesDuration of each time group in milliseconds. Controls how much data is read per subtask together with oidBatch. Example: 604800000 (7 days). Set to less than one day if data is reported at second-level frequency; use a larger value for hourly reporting.
selfIdYesID of this migration task. If running multiple concurrent tasks, list all task IDs in jobIds.
jobIdsYesList of migration task IDs.
jobNameYesName of the migration task. Used as the suffix of the task status list (internal_datax_job<jobName>). All concurrent tasks sharing the same job must use the same name.
oidPathYesPath to the file containing all time series to migrate in the TSDB instance.
oidBatchYesNumber of time series each read subtask processes at once. Together with splitIntervalMs and the reporting frequency, determines how many data points are read per subtask.
oidCacheYesWhether to cache time series in memory. If you want to migrate tens of billions of time series, not all time series can be cached in the memory.
metricsNoSpecific metrics to migrate. This parameter does not have a default value. Example: ["METRIC_1","METRIC_2"...].

How splitIntervalMs and oidBatch determine read volume

Each read subtask reads oidBatch × splitIntervalMs / reportingInterval data points. For example, with oidBatch set to 100, splitIntervalMs set to 604800000, and hourly reporting:

100 × 604800000 / 3600000 = 16,800 data points per subtask

Writer parameters (LindormTSDB destination)

ParameterRequiredDescription
endpointYesLindormTSDB endpoint. For details, see View endpoints.
batchSizeYesMaximum number of data points sent to LindormTSDB in a single write request.
multiFieldYesSet to true to use the multi-value data model.

Example configuration

The following example shows a complete job.json file:

{
    "job": {
        "setting": {
            "speed": {
                "channel": 1
            },
            "errorLimit": {
                "record": 0,
                "percentage": 0.00
            }
        },
        "content": [
            {
                "reader": {
                    "name": "tsdbreader",
                    "parameter": {
                        "sinkDbType": "LINDORM-MIGRATION",
                        "endpoint": "ts-xxxx:3242",
                        "beginDateTime": "2022-5-2 00:00:00",
                        "endDateTime": "2022-7-2 00:00:00",
                        "splitIntervalMs": 86400000,
                        "jobName": "myjob",
                        "selfId": 1,
                        "jobIds": [1],
                        "oidPath": "{$myworkplace}/oidfile",
                        "oidBatch": 100,
                        "oidCache": true
                    }
                },
                "writer": {
                    "name": "tsdbwriter",
                    "parameter": {
                        "endpoint": "ld-xxxx:8242",
                        "multiField": true,
                        "batchSize": 500
                    }
                }
            }
        ]
    }
}

Replace the placeholders with your actual values:

PlaceholderDescriptionExample
ts-xxxx:3242TSDB instance endpoint (port 3242)ts-bp1xxxxx:3242
ld-xxxx:8242LindormTSDB endpoint (port 8242)ld-bp1xxxxx:8242
{$myworkplace}/oidfilePath to the time series file in the TSDB instance/data/migration/oidfile

Run the migration

  1. Download the migration tool.

  2. Decompress the package:

    tar -zxvf tsdb2lindorm.tar.gz
  3. Start the migration task:

    python datax/bin/datax.py --jvm="-Xms8G -Xmx8G" job.json > job.result

    Replace job with the name of your configuration file.

  4. After the command finishes, check job.result for errors. If the file contains no error output, the migration completed successfully.

  5. (Optional) If the task fails, query the task status list to identify which time groups succeeded and where to resume:

    curl -u <username>:<password> <tsdb-endpoint>:3242/api/mquery -XPOST -d '{
        "start": 1,
        "queries": [
            {
                "metric": "internal_datax_job<jobName>",
                "fields": [
                    {
                        "field": "*",
                        "aggregator": "none"
                    }
                ]
            }
        ]
    }'

    Replace the placeholders:

    PlaceholderDescriptionExample
    <username>:<password>TSDB account credentials. See Manage accounts.admin:mypassword
    <tsdb-endpoint>TSDB instance IDts-****
    <jobName>Migration task nameinternal_datax_jobmyjob

    The response lists each time group with its completion status:

    Timestamp (endtime)jobId (tag)state (field)
    1651795199999 (2022-05-05 23:59:59.999)3ok
    1651795199999 (2022-05-05 23:59:59.999)2ok
    1651795199999 (2022-05-05 23:59:59.999)1ok
    1651881599999 (2022-05-06 23:59:59.999)2ok

    To resume without re-migrating completed time groups, update beginDateTime in job.json to the start of the first incomplete time group before restarting. In this example, set beginDateTime to 2022-05-06 00:00:00.

Query migrated data

TSDB data originally written with the single-value model is stored in LindormTSDB under the multi-value data model. Use the /api/mquery endpoint and the multi-value query format when reading this data.

The following example shows the query difference for a metric named test_metric:

Query in TSDB:

curl -u username:password ts-xxxxx:3242/api/query -XPOST -d '{
    "start": 1657004460,
    "queries": [
        {
            "aggregator": "none",
            "metric": "test_metric"
        }
    ]
}'

Response from TSDB:

[
    {
        "aggregateTags": [],
        "dps": {
            "1657004460": 1.0
        },
        "fieldName": "",
        "metric": "test_metric",
        "tags": {
            "tagkey1": "1"
        }
    }
]

Query in LindormTSDB:

curl -u username:password ld-xxxxx:8242/api/mquery -XPOST -d '{
    "start": 1657004460,
    "queries": [
        {
            "metric": "test_metric",
            "fields": [
                {
                    "field": "*",
                    "aggregator": "none"
                }
            ],
            "aggregator": "none"
        }
    ]
}'

Response from LindormTSDB:

[
  {
    "aggregatedTags": [],
    "columns": [
      "timestamp",
      "value"
    ],
    "metric": "test_metric",
    "tags": {
      "tagkey1": "1"
    },
    "values": [
      [
        1657004460000,
        1.0
      ]
    ]
  }
]

Key differences:

  • Use /api/mquery instead of /api/query.

  • Specify fields explicitly using the fields array.

  • Timestamps in LindormTSDB responses are in milliseconds (13 digits), compared to seconds (10 digits) in TSDB.

Performance test results

Use the following results as a reference when planning your migration. Actual performance depends on your instance specification, data volume, and reporting frequency.

TSDB Basic Edition II (4 CPU cores, 8 GB memory) — 2 instances

TestTime seriesData pointsProcessesConfigurationTime series file sizeThroughput (data points/sec)DurationCPU utilization
130,00086,400,0001channel: 2, oidCache: true, oidBatch: 100, splitInterval: 6h, mem: -Xms6G -Xmx6G1.5 MB230,00012 min 30 sec30%
26,000,0002,592,000,0001channel: 10, oidCache: true, oidBatch: 100, splitInterval: 6h, mem: -Xms8G -Xmx8G292 MB200,0002 hr 55 min 30 sec70%–90%
330,000,0004,320,000,0001channel: 10, oidCache: false, oidBatch: 100, splitInterval: 6h, mem: -Xms28G -Xmx28G1.5 GB140,0009 hours40%–80%
430,000,0004,320,000,0003channel: 10, oidCache: false, oidBatch: 100, splitInterval: 6h, mem: -Xms8G -Xmx8G1.5 GB250,0005 hours90%

TSDB Standard Edition I (8 CPU cores, 16 GB memory) — 2 instances

Time seriesData pointsProcessesConfigurationTime series file sizeThroughput (data points/sec)DurationCPU utilization
40,000,0005,760,000,0003channel: 10, oidCache: false, oidBatch: 100, splitInterval: 6h, mem: -Xms8G -Xmx8G2 GB150,000–200,0009 hours10%–20%

What's next

  • To query migrated data using SQL, create a time series table in LindormTSDB before migrating. See the LindormTSDB documentation for instructions on creating time series tables.

  • After migration, validate a sample of your data in LindormTSDB using the query examples in Query migrated data.