Lindorm-cli is a lightweight command line interface (CLI) provided by Lindorm for connecting to and managing Lindorm databases. Use Lindorm-cli to perform basic SQL operations such as creating tables, querying data, writing data, and exporting data. This topic describes how to connect to and use the Lindorm wide table engine with Lindorm-cli.
Prerequisites
We define the environment where you run lindorm-cli as the client environment. Before using lindorm-cli to access the Lindorm wide table engine, confirm the following:
Add the client IP address to the Lindorm whitelist. For more information, see Configure a whitelist.
Determine the network type between the client environment and Lindorm.
The following network types are supported when connecting to the wide table engine with lindorm-cli:
Network type
Description
Virtual private cloud (VPC) (recommended)
A virtual private cloud (VPC) is your private network in the cloud. Different VPCs are isolated at layer 2 logical isolation, providing high security. When you deploy lindorm-cli on an ECS instance, connecting to the Lindorm wide table engine over a VPC provides higher security and lower network latency.
Public network
The public network refers to the Internet. When you need to test or manage the Lindorm wide table engine from an on-premises device, deploy lindorm-cli on the local device and connect to the Lindorm wide table engine over the public network.
NoteConnecting over the public network does not incur traffic fees but poses a security risk. We recommend using a VPC for higher security.
You must enable the public endpoint in the console. For more information, see Procedure.
Installation
Download the Lindorm-cli installation package that matches your operating system. The download links are listed in the following table.
NoteThe SHA256 checksums in the table can be used to verify the integrity and authenticity of the downloaded Lindorm-cli packages.
Operating system
Download link
SHA256 checksum
Linux
Direct download command:
wget https://tsdbtools.oss-cn-hangzhou.aliyuncs.com/lindorm-cli-linux-latest.tar.gz3a9ee33e24769cf47b3a90c3a1bba29d26f8aede7a64dbc13ea1f4f5426f04e4
Linux-arm64
Direct download command:
wget https://tsdbtools.oss-cn-hangzhou.aliyuncs.com/lindorm-cli-linux-arm64-latest.tar.gzbc723d4a3a14a85c973c7082a56bb4934a40d2b9cccd72b5767352b8c334ce19
Mac (Intel chip)
34efd3f43a700e1fea72ee5e5933b9df3cf624569bcf59a2f8a6752dc7faab6c
Mac (Arm chip)
0be9b346404a37d953714377b59f06b6492ff9c4e46dba4d5bf07c390ee284ad
Windows
54a447f263b93b158533f7ccd542cbf52e42fb66ce287d38065a798b7801fc48
Decompress the Lindorm-cli package.
Use the standard decompression method for your operating system to extract the downloaded package.
For Linux, run the following command to decompress the package. After decompression, you get the
lindorm-clifile. This executable file can be run directly in a shell terminal without additional installation steps.tar zxvf lindorm-cli-linux-latest.tar.gz
Connection methods
Lindorm-cli supports connecting to the Lindorm wide table engine using either the MySQL protocol or the Avatica protocol. We recommend using the MySQL protocol.
Only lindorm-cli versions 2.0.0 and later support connecting to the wide table engine using the MySQL protocol.
Connect to the wide table engine using the MySQL protocol (recommended)
Client deployed on Linux or Mac
Go to the directory that contains
Lindorm-cli.cd <Lindorm-cli directory>Run the following command to connect to the wide table engine.
./lindorm-cli -url <mysql url> -username <username> -password <password>Parameter description
Parameter
Description
mysql url
The MySQL-compatible endpoint of the Lindorm wide table engine. For more connection configuration details, see Connection configuration.
username
The username for connecting to the Lindorm wide table engine.
password
The password for connecting to the Lindorm wide table engine.
ImportantIf you forget your password, you can reset the user password in the Lindorm wide table engine cluster management system.
After resetting the password, restart the engine in the console.
Connection configuration
Supported connection configurations
Description
mysql://protocol headerYou can prepend the
mysql://protocol header to the mysql url.Example:
mysql://ld-8vbn68478unu8****-proxy-sql-lindorm.lindorm.rds.aliyuncs.com:33060.Server-side custom connection parameters
You can append server-side custom connection parameters to the mysql url in the format
key1=value1&key2=value2.The following parameter is currently supported:
operationTimeout: Specifies the query timeout period. The format is
<mysql url>?operationTimeout=<timeout>, where the timeout unit is milliseconds (ms). Example:ld-bp187uwcx5f40****-proxy-lindorm-vpc.lindorm.aliyuncs.com:33060?operationTimeout=120000.ImportantOnly wide table engine versions 2.7.7 and later support the operationTimeout parameter. For information about how to view or upgrade your current version, see Wide table engine version guide and Minor version update.
Connection examples
./lindorm-cli -url ld-bp187uwcx5f40****-proxy-lindorm-vpc.lindorm.aliyuncs.com:33060 -username user -password test --Add mysql:// protocol header ./lindorm-cli -url mysql://ld-bp187uwcx5f40****-proxy-lindorm-vpc.lindorm.aliyuncs.com:33060 -username user -password test --Specify query timeout ./lindorm-cli -url mysql://ld-bp187uwcx5f40****-proxy-lindorm-vpc.lindorm.aliyuncs.com:33060?operationTimeout=120000 -username user -password testA successful connection returns the following result:
lindorm-cli version: 2.0.xHere,
2.0.xis the Lindorm-cli version number.
Client deployed on Windows
Method 1
Open Command Prompt (CMD) and go to the directory that contains
lindorm-cli.exe.cd <lindorm-cli.exe directory>Run the following command in CMD to connect to the wide table engine.
lindorm-cli -url <mysql url> -username <username> -password <password>Parameter description
Parameter
Example value
How to obtain
mysql url
ld-bp187uwcx5f40****-proxy-lindorm-vpc.lindorm.aliyuncs.com:33060
The MySQL-compatible endpoint of the Lindorm wide table engine. For more connection configuration details, see Connection configuration.
username
user
The username for connecting to the Lindorm wide table engine.
password
test
The password for connecting to the Lindorm wide table engine.
ImportantIf you forget your password, you can reset the user password in the Lindorm wide table engine cluster management system.
After resetting the password, restart the engine in the console.
Connection configuration
Supported connection configurations
Description
mysql://protocol headerYou can prepend the
mysql://protocol header to the mysql url.Example:
mysql://ld-8vbn68478unu8****-proxy-sql-lindorm.lindorm.rds.aliyuncs.com:33060.Server-side custom connection parameters
You can append server-side custom connection parameters to the mysql url in the format
key1=value1&key2=value2.The supported parameters are as follows:
operationTimeout: Specifies the query timeout period. The format is
<mysql url>?operationTimeout=<timeout>, where the timeout unit is milliseconds (ms). Example:ld-bp187uwcx5f40****-proxy-lindorm-vpc.lindorm.aliyuncs.com:33060?operationTimeout=120000.ImportantOnly wide table engine versions 2.7.7 and later support the operationTimeout parameter. For information about how to view or upgrade your current version, see Wide table engine version guide and Minor version update.
Connection examples
lindorm-cli -url ld-bp187uwcx5f40****-proxy-lindorm-vpc.lindorm.aliyuncs.com:33060 -username user -password test --Add mysql:// protocol header lindorm-cli -url mysql://ld-bp187uwcx5f40****-proxy-lindorm-vpc.lindorm.aliyuncs.com:33060 -username user -password test --Specify query timeout lindorm-cli -url mysql://ld-bp187uwcx5f40****-proxy-lindorm-vpc.lindorm.aliyuncs.com:33060?operationTimeout=120000 -username user -password testA successful connection returns the following result:
Connected to ld-bp187uwcx5f40****-proxy-sql-lindorm-public.lindorm.rds.aliyuncs.com:33060 lindorm-cli version: 2.0.xHere,
2.0.xis the Lindorm-cli version number.
Method 2
Double-click to open the Lindorm-cli.exe program and run the following command:
connect <mysql url> <username> <password>Connection example
connect ld-bp13y790c91f4****-proxy-lindorm-pub.lindorm.aliyuncs.com:33060 user testA successful connection returns no output.
Connect to the wide table engine using the Avatica protocol
Client deployed on Linux or Mac
Go to the directory that contains
Lindorm-cli.cd <Lindorm-cli directory>Run the following command to connect to the wide table engine.
./lindorm-cli -url <url> -username <username> -password <password>Parameter description
Parameter
Example value
How to obtain
jdbc url
jdbc:lindorm:table:url=http://ld-bp17j28j2y7pm****-proxy-lindorm-pub.lindorm.rds.aliyuncs.com:30060
The wide table SQL endpoint of the Lindorm wide table engine.
username
user
The username for connecting to the Lindorm wide table engine.
password
test
The password for connecting to the Lindorm wide table engine.
ImportantIf you forget your password, you can reset the user password in the Lindorm wide table engine cluster management system.
After resetting the password, restart the engine in the console.
Connection example
./lindorm-cli -url jdbc:lindorm:table:url=http://ld-bp17j28j2y7pm****-proxy-lindorm-pub.lindorm.rds.aliyuncs.com:30060 -username user -password testA successful connection returns the following result:
lindorm-cli version: 2.0.xxHere,
2.0.xxis the Lindorm-cli version number.
Client deployed on Windows
Method 1
Open Command Prompt (CMD) and go to the directory that contains
lindorm-cli.exe.cd <lindorm-cli.exe directory>Run the following command in CMD to connect to the wide table engine.
lindorm-cli -url <jdbc url> -username <username> -password <password>Parameter description
Parameter
Example value
How to obtain
jdbc url
jdbc:lindorm:table:url=http://ld-bp17j28j2y7pm****-proxy-lindorm-pub.lindorm.rds.aliyuncs.com:30060
The wide table SQL endpoint of the Lindorm wide table engine.
username
user
The username for connecting to the Lindorm wide table engine.
password
test
The password for connecting to the Lindorm wide table engine.
ImportantIf you forget your password, you can reset the user password in the Lindorm wide table engine cluster management system.
After resetting the password, restart the engine in the console.
Connection example
lindorm-cli -url jdbc:lindorm:table:url=http://ld-bp13y790c91f4****-proxy-lindorm-pub.lindorm.aliyuncs.com:30060 -username user -password testA successful connection returns the following result:
Connected to jdbc:lindorm:table:url=http://ld-bp13y790c91f4****-proxy-lindorm-pub.lindorm.rds.aliyuncs.com:30060 lindorm-cli version: 2.0.xxHere,
2.0.xxis the Lindorm-cli version number.
Method 2
Double-click to open the Lindorm-cli.exe program and run the following command:
connect <jdbc url> <username> <password>Connection example
connect jdbc:lindorm:table:url=http://ld-bp13y790c91f4****-proxy-lindorm-pub.lindorm.aliyuncs.com:30060 user testA successful connection returns no output.
Usage
Lindorm-cli supports both interactive and non-interactive modes for executing SQL statements against the wide table engine.
Execute SQL statements in interactive mode
In most cases, you start lindorm-cli in interactive mode to operate the wide table engine. The workflow is as follows:
Start lindorm-cli
After connecting to the Lindorm wide table engine using any protocol described in the previous section, your terminal enters the lindorm-cli interactive interface and waits for further commands.NoteOn Windows, double-clicking lindorm-cli.exe opens a CMD terminal window. This starts the lindorm-cli interactive interface but does not establish a connection to the Lindorm wide table engine. You must use the connect subcommand to establish a connection before running SQL statements. For more information, see Client deployed on Windows and Method 2.
Enter SQL statements to access the wide table engine
After establishing a connection and entering the interactive interface, enter SQL statements to access the wide table engine. For supported SQL syntax, see SQL reference.Exit lindorm-cli
After completing your operations in the interactive interface, exit lindorm-cli by running theexitsubcommand or pressing thectrl+dkeyboard shortcut.
After starting lindorm-cli in interactive mode and successfully connecting to the wide table engine, the client maintains a session with the engine until you exit. All SQL operations during this period run in the same session. Note that if the session remains idle for too long, the system automatically disconnects to reclaim resources.
Execute SQL statements in non-interactive mode
When writing O&M scripts, to directly execute Lindorm SQL statements without entering the interactive command line, you can use the non-interactive mode of lindorm-cli to work with LindormTable. This mode directly runs SQL via command parameters and returns the results, making it suitable for automated tasks such as performing queries or statistical operations.
To execute an SQL statement in non-interactive mode from a shell terminal, append the -execute parameter followed by the SQL statement enclosed in single or double quotes to the connection parameters (such as host address and port) described in Connection methods. This quickly establishes a short-lived connection and executes the command. Example:
lindorm-cli -url mysql://ld-xxxxxx-proxy-lindorm-vpc.lindorm.aliyuncs.com:33060 -username user -password XXXX -execute "CREATE TABLE tb (id VARCHAR, name VARCHAR, address VARCHAR, PRIMARY KEY(id, name));"You can also export wide table query results to a CSV file using non-interactive mode.
Exporting to CSV requires lindorm-cli version 2.2.0 or later. To check your current version:
Run
lindorm-cli -versionin the command line.Check the version displayed in the welcome message when entering interactive mode.
lindorm-cli -url mysql://ld-xxxxxx-proxy-lindorm-vpc.lindorm.aliyuncs.com:33060 -username user -password XXXX -format csv -output ~/result.csv -execute "SELECT * FROM tb;"Short-lived connections: In non-interactive mode, lindorm-cli establishes a new connection for each SQL statement and closes it immediately after execution.
Output control: Results are printed to the terminal screen (stdout) by default. To redirect output to a file, use the
-outputparameter.
Command line parameters and subcommands
Command line parameters
When starting lindorm-cli in a terminal, you can specify the following command line parameters:
Parameter name | Requires value | Value | Description |
url | Yes | Protocol name + SQL connection string (including port) for the Lindorm wide table engine | Specifies the protocol and connection string for lindorm-cli to connect to the wide table engine.
|
username | Yes | Username for the connection | The specified username must be a Lindorm user already created in the wide table engine. |
password | Yes | Password for the username | - |
database | Yes | Database name to connect to | If not specified, the default database is used. If specified, the database must already exist in the wide table engine. |
execute | Yes | SQL statement to execute | When the execute parameter is specified, lindorm-cli runs in non-interactive mode. Enclose the SQL statement in single or double quotes. Note When using double quotes to enclose the SQL statement, escape internal double quotes with a backslash |
output | Yes | Output location for SQL execution results in non-interactive mode | In non-interactive mode, if output is not specified, results are printed to standard output. If specified, results are written to the file at the given path. If the file does not exist, it will be created. |
format | Yes | One of the following: horizontal, vertical, csv, json, column | Changes the format of SQL execution results returned by the wide table engine. The default format is column.
|
pretty | No | - | Use with format set to JSON. When enabled, results are output as pretty-printed JSON. By default, results are output as compact JSON. |
csvNoHeader | No | - | Use with format set to CSV. When enabled, results are output in CSV format without column headers. |
nullString | Yes | String to replace NULL values | Use with format set to CSV. When specified, NULL values in query results are replaced with the given string. If nullString is not specified, NULL values are output as follows:
|
version | No | - | Displays the lindorm-cli version information. Lindorm-cli does not start or enter interactive mode when this parameter is used. |
All lindorm-cli command line parameters must be prefixed with a hyphen -.
Common subcommands
After starting lindorm-cli in interactive mode, you can run lindorm-cli subcommands in the interactive interface to control its behavior, in addition to sending SQL statements to the Lindorm wide table engine. Common subcommands are listed below:
Subcommand | Parameters | Description |
connect | <url> <username> <password> | When lindorm-cli is started in interactive mode without a connection, use the connect subcommand to establish a connection to the Lindorm wide table engine. The url, username, and password parameters have the same meanings as the command line parameters |
format | One of the following: horizontal, vertical, csv, json | Same as the |
help | None | Displays a list of common subcommands. |
history | None | Displays recently executed SQL statements or subcommands. |
exit or quit | None | Exits lindorm-cli and disconnects from the Lindorm wide table engine. |
FAQ
Why am I experiencing connection timeouts or failures?
Connection timeouts or failures return errors such as Failed to connect to <wide table endpoint> connection check failed or connection timeout.
Possible causes and solutions are listed below. Check them in order:
Cause | Solution |
Using a public network connection without adding the public IP address to the whitelist. | Add the client public IP address to the Lindorm whitelist. To find your client public IP address, run |
The public IP address is added to the whitelist, but connection timeouts persist. | Network instability may be the cause. We recommend switching to a VPC connection. |
Accessing from an ECS instance without adding the ECS IP address to the Lindorm whitelist. | Obtain the ECS IP address and add it to the Lindorm whitelist. |
Using an incorrect endpoint. | Lindorm endpoints differ for VPC and public network connections. Use the correct endpoint based on your network environment. |
If none of these solutions resolve your issue, contact Lindorm technical support (DingTalk ID: s0s3eg3).
References
For information about Lindorm wide table SQL syntax, see SQL reference.
Other connection methods: Connect to and use the wide table engine with the MySQL command line, Use the MySQL protocol (recommended).