All Products
Search
Document Center

Lindorm:Connect to and use LindormTSDB using Lindorm-cli

Last Updated:Mar 28, 2026

Lindorm-cli is a lightweight command-line interface (CLI) for connecting to and managing Lindorm databases. Use it to run SQL operations against Lindorm Time Series Database (LindormTSDB) — create tables, write data, and query results — without installing a full SDK.

Prerequisites

Before you begin, ensure that you have:

  • Added your client's IP address to the Lindorm whitelist. See Set a whitelist.

Step 1: Install Lindorm-cli

  1. Download the Lindorm-cli package for your operating system. On Linux, you can also download directly from the terminal:

    Use the SHA256 checksums in the table to verify the integrity of the downloaded package.
    Operating systemDownload link
    Linuxlindorm-cli for Linux
    Linux (arm64)lindorm-cli for Linux arm64
    macOS (Intel)lindorm-cli for macOS (Intel)
    macOS (Apple silicon)lindorm-cli for macOS (Apple silicon)
    Windowslindorm-cli for Windows x64
    # x86_64
    wget https://tsdbtools.oss-cn-hangzhou.aliyuncs.com/lindorm-cli-linux-latest.tar.gz
    
    # arm64
    wget https://tsdbtools.oss-cn-hangzhou.aliyuncs.com/lindorm-cli-linux-arm64-latest.tar.gz
  2. Extract the package. On Linux or macOS:

    tar zxvf lindorm-cli-linux-latest.tar.gz

    After extraction, the lindorm-cli binary is in the lindorm-cli-linux-latest folder. (Optional) Add the binary to your $PATH so you can run lindorm-cli from any directory. If you skip this step, run the binary using its full path (for example, ./lindorm-cli).

Step 2: Connect to LindormTSDB

Linux and macOS

  1. Navigate to the folder containing the lindorm-cli binary.

    cd <folder where lindorm-cli is stored>
  2. Connect to LindormTSDB.

    Parameters:

    ParameterRequiredDefaultDescription
    -urlYesThe LindormTSDB SQL URL. Example: jdbc:lindorm:tsdb:url=http://ld-bp12pc23yfb3*****-proxy-tsdb-pub.lindorm.rds.aliyuncs.com:8242. You can also use a LindormTSDB HTTP endpoint. See View endpoints.
    -usernameNo(none)The username for LindormTSDB. Omit if user authentication is not enabled. See User and permission management.
    -passwordNo(none)The password for LindormTSDB. Omit if user authentication is not enabled. To reset your password, see Change the password.
    -databaseNodefaultThe database to connect to. To switch databases after connecting, run use <database name>.
    ./lindorm-cli -url <LindormTSDB SQL URL> -username <username> -password <password> -database <database name>

    Example:

    ./lindorm-cli -url jdbc:lindorm:tsdb:url=http://ld-4xo90g5i370cu****-proxy-tsdb.lindorm.rds.aliyuncs.com:8242 -username user -password test -database default

    A successful connection returns the Lindorm-cli version:

    lindorm-cli version: 1.0.xx

    Enter help to see available commands.

Windows

Method 1: Command prompt

  1. Open Command Prompt (CMD) and navigate to the folder containing lindorm-cli.exe.

    cd <folder where lindorm-cli.exe is stored>
  2. Connect to LindormTSDB.

    lindorm-cli -url <LindormTSDB SQL URL> -username <username> -password <password> -database <database name>

    A successful connection returns:

    Connected to jdbc:lindorm:tsdb:url=http://****-proxy-tsdb-pub.lindorm.rds.aliyuncs.com:8242
    lindorm-cli version: 1.0.xx

Method 2: Double-click

Double-click Lindorm-cli.exe, then run:

connect <LindormTSDB SQL URL> <username> <password> -database <database name>

If the connection succeeds, no output is returned.

Step 3: Use LindormTSDB

The following examples use a sensor table that records temperature and humidity readings from IoT devices.

Create a table

LindormTSDB uses SQL syntax for DDL. Two constraints apply when creating a time series table:

  • The timestamp column must be named time. It stores timestamps in milliseconds (ms).

  • Specify a PRIMARY KEY to uniquely identify a data source — for example, a device ID in Internet of Things (IoT) scenarios, a vehicle identifier in Internet of Vehicles (IoV) scenarios, or an ip:port pair in monitoring scenarios.

The Basic Edition does not support primary keys.
  1. Create the sensor table.

    CREATE TABLE sensor (
        device_id VARCHAR NOT NULL,
        region VARCHAR NOT NULL,
        time TIMESTAMP NOT NULL,
        temperature DOUBLE,
        humidity BIGINT,
        PRIMARY KEY(device_id, region, time)
    );
  2. Verify the table was created.

    SHOW TABLES;

    Expected output:

    +-------------------+
    | Tables_In_default |
    +-------------------+
    | sensor            |
    +-------------------+
  3. Inspect the table schema.

    DESCRIBE TABLE sensor;

    Expected output:

    +-------------+-----------+------------+------------+--------------+
    | columnName  | typeName  | columnKind | primaryKey | partitionTag |
    +-------------+-----------+------------+------------+--------------+
    | device_id   | VARCHAR   | TAG        | true       | true         |
    | region      | VARCHAR   | TAG        | true       | true         |
    | time        | TIMESTAMP | TIMESTAMP  | true       | false        |
    | temperature | DOUBLE    | FIELD      | false      | false        |
    | humidity    | BIGINT    | FIELD      | false      | false        |
    +-------------+-----------+------------+------------+--------------+

Write data

Data points with the same tags and timestamp are treated as the same data point. Later writes overwrite earlier ones.

Write individual rows:

INSERT INTO sensor (device_id, region, time, temperature, humidity) VALUES('F07A1260','north-cn','2021-04-22 15:33:00',12.1,45);
INSERT INTO sensor (device_id, region, time, temperature, humidity) VALUES('F07A1260','north-cn','2021-04-22 15:33:10',13.2,47);
INSERT INTO sensor (device_id, region, time, temperature, humidity) VALUES('F07A1260','north-cn','2021-04-22 15:33:20',10.6,46);
INSERT INTO sensor (device_id, region, time, temperature, humidity) VALUES('F07A1261','south-cn','2021-04-22 15:33:00',18.1,44);
INSERT INTO sensor (device_id, region, time, temperature, humidity) VALUES('F07A1261','south-cn','2021-04-22 15:33:10',19.7,44);

Or write multiple rows in a single statement:

INSERT INTO sensor (device_id, region, time, temperature, humidity)
VALUES ('F07A1260','north-cn','2021-04-22 15:33:00',12.1,45),
       ('F07A1260','north-cn','2021-04-22 15:33:10',13.2,47),
       ('F07A1260','north-cn','2021-04-22 15:33:20',10.6,46),
       ('F07A1261','south-cn','2021-04-22 15:33:00',18.1,44),
       ('F07A1261','south-cn','2021-04-22 15:33:10',19.7,44);

Query data

Conditional query

Query readings for device F07A1260 between 2021-04-22 15:33:00 and 2021-04-22 15:33:20:

SELECT device_id,region,time,temperature,humidity FROM sensor WHERE device_id = 'F07A1260' AND time >= '2021-04-22 15:33:00' AND time <= '2021-04-22 15:33:20';

Result:

+-----------+----------+---------------------------+-------------+----------+
| device_id |  region  |           time            | temperature | humidity |
+-----------+----------+---------------------------+-------------+----------+
| F07A1260  | north-cn | 2021-04-22T15:33:00+08:00 | 12.1        | 45       |
| F07A1260  | north-cn | 2021-04-22T15:33:10+08:00 | 13.2        | 47       |
| F07A1260  | north-cn | 2021-04-22T15:33:20+08:00 | 10.6        | 46       |
+-----------+----------+---------------------------+-------------+----------+

Downsampling query

A downsampling query aggregates values within fixed time intervals to reduce the number of data points in the result set. Use SAMPLE BY to set the interval.

Get the maximum temperature for device F07A1260 over a 20-second window:

SELECT device_id,region,time,max(temperature) AS max_temperature FROM sensor WHERE device_id = 'F07A1260' AND time >= '2021-04-22 15:33:00' AND time <= '2021-04-22 15:33:20' SAMPLE BY 20s;

Result:

+-----------+----------+---------------------------+-----------------+
| device_id |  region  |           time            | max_temperature |
+-----------+----------+---------------------------+-----------------+
| F07A1260  | north-cn | 2021-04-22T15:33:00+08:00 | 13.2            |
| F07A1260  | north-cn | 2021-04-22T15:33:20+08:00 | 10.6            |
+-----------+----------+---------------------------+-----------------+

Aggregate query

Calculate the maximum temperature per region across all devices:

SELECT region,max(temperature) AS max_temperature FROM sensor WHERE time >= '2021-04-22 15:33:00' AND time <= '2021-04-22 15:33:20' GROUP BY region;

Result:

+----------+-----------------+
|  region  | max_temperature |
+----------+-----------------+
| north-cn | 13.2            |
| south-cn | 19.7            |
+----------+-----------------+

Common Lindorm-cli commands

CommandDescription
helpLists available commands.
connect <url> <username> <password> -database <name>Connects to a server.
precision <format>Sets the time display format. Valid values: rfc3339, h, m, s, ms, u, ns.
use <database name>Switches to a different database in the current session.
exit or quitDisconnects and exits Lindorm-cli.

FAQ

Why is my query returning no results after writing data?

Run DESCRIBE DATABASE <database name> and check whether a time to live (TTL) is configured. If the data's age exceeds the TTL, LindormTSDB automatically deletes it and the data no longer appears in query results.

Can Lindorm-cli import and export CSV files?

For small datasets, Lindorm-cli supports CSV import and export. Contact Lindorm technical support (DingTalk group: s0s3eg3) for this feature.

For large datasets, use DataX to import data. Exporting large-scale data is not supported.