All Products
Search
Document Center

Lindorm:Use Lindorm-cqlsh to connect to LindormTable

Last Updated:Mar 28, 2026

Lindorm-cqlsh is a command-line shell provided by the Lindorm team, based on Cassandra cqlsh. It supports Windows and Unix, and runs on your local machine or an ECS instance. Use it to connect to and query LindormTable.

Lindorm-cqlsh is based on Cassandra cqlsh but is not fully compatible with all Cassandra table attributes. Attributes not supported by Lindorm are returned with their Cassandra default values.

Prerequisites

Before you begin, make sure that you have:

If your application runs on an ECS instance, the Lindorm instance and ECS instance must meet these network requirements:

  • Both instances are in the same region. Deploy them in the same zone to reduce network latency.

  • Both instances use the same network type.

For details on viewing ECS instance information, see View instance information.

Connect to LindormTable

Run the following command to connect Lindorm-cqlsh to LindormTable:

bin/cqlsh <host> <port> -u <username> -p <password>

Replace the placeholders with your values:

ParameterDescriptionDefault
<host>The CQL Connection endpoint from the Lindorm console. Example: ld-bp17j28j2y7pm****-proxy-lindorm.lindorm.rds.aliyuncs.com
<port>The port of the CQL Connection endpoint for the wide-table engine.9042
<username>The username for LindormTable.root
<password>The password for the username. To reset a forgotten password, see Reset password.

Set the Python version in the bin/cqlsh path to 2.7.x. For all available options, run bin/cqlsh -help.

Work with LindormTable

The following steps walk through common table operations using Lindorm-cqlsh.

Step 1: Create a keyspace

A keyspace in Lindorm is equivalent to a database in a relational database system. It can contain one or more tables or column families.

Create a keyspace named test_keyspace:

CREATE KEYSPACE test_keyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};

Verify that the keyspace was created:

DESCRIBE KEYSPACE test_keyspace;

Step 2: Switch to the keyspace

USE test_keyspace;

The prompt changes to confirm the active keyspace:

cqlsh:test_keyspace>

Step 3: Create a table

Create a table named test_user with two TEXT columns. first_name is the primary key.

CREATE TABLE test_user(first_name text, last_name text, PRIMARY KEY (first_name));

If you skipped USE test_keyspace;, qualify the table name with the keyspace:

CREATE TABLE test_keyspace.test_user(first_name text, last_name text, PRIMARY KEY (first_name));

Verify the table structure:

DESCRIBE TABLE test_user;

The output shows both your custom settings and Cassandra default values for unsupported attributes.

Cassandra compatibility

Lindorm does not fully support all Cassandra table attributes. Unsupported attributes are still returned in DESCRIBE TABLE output, but their values reflect Cassandra defaults rather than actual settings.

Attribute behaviorAttributes
Ignored by Lindorm (returned with Cassandra defaults)crc_check_chance, gc_grace_seconds, read_repair_chance, speculative_retry, dclocal_read_repair_chance
Fully supportedcompression, default_time_to_live

Step 4: Insert data

INSERT INTO test_user (first_name, last_name) VALUES ('test', 'LINDORM');
INSERT INTO test_user (first_name, last_name) VALUES ('Zhang', 'San');
INSERT INTO test_user (first_name) VALUES ('Wu');

Step 5: Query data

Verify the row count:

SELECT COUNT(*) FROM test_user;
 count
-------
     3

(1 rows)

Avoid SELECT COUNT(*) on tables with large amounts of data.

Query all rows:

SELECT * FROM test_user;
 first_name | last_name
------------+-----------
       test |    LINDORM
         Wu |      null
      Zhang |       San

(3 rows)

Step 6: Delete data

Delete a column value — remove last_name for a specific row, then verify:

DELETE last_name FROM test_user WHERE first_name='test';
SELECT * FROM test_user WHERE first_name='test';
 first_name | last_name
------------+-----------
       test |      null

Delete a row — remove the entire row, then verify:

DELETE FROM test_user WHERE first_name='test';
SELECT * FROM test_user WHERE first_name='test';
 first_name | last_name
------------+-----------

(0 rows)

Step 7: Truncate or drop a table

Only superusers can run TRUNCATE, DROP TABLE, and DROP KEYSPACE.

TRUNCATE test_user;
DROP TABLE test_user;

Create indexes

Search index

Use Lindorm Cassandra Query Language (CQL) commands to create a search index on a wide table. Before creating a search index, make sure the table attributes meet the requirements. For requirements, submit a ticket to contact technical support.

The following example creates a table tb, builds a search index tbidx on columns cn2 and cn3, and runs a fuzzy query:

CREATE TABLE test_keyspace.tb (cn1 text PRIMARY KEY, cn2 text, cn3 text) WITH extensions = {'CONSISTENCY_TYPE':'strong', 'MUTABILITY':'MUTABLE_LATEST'};
CREATE SEARCH INDEX tbidx ON test_keyspace.tb WITH COLUMNS (cn2, cn3);
REBUILD SEARCH INDEX ON test_keyspace.tb;
INSERT INTO test_keyspace.tb (cn1, cn2, cn3) VALUES ('v11', 'v12', 'v13');
SELECT * FROM test_keyspace.tb WHERE cn2 like '%v1';

Secondary index

Use Lindorm CQL commands to create a secondary index on a wide table. Before creating a secondary index, make sure the table attributes meet the requirements. For requirements, see Secondary index.

The following example creates a table tb, adds a secondary index tbidx on cn2, and queries by that column:

CREATE TABLE test_keyspace.tb (cn1 text PRIMARY KEY, cn2 text, cn3 text) WITH extensions = {'CONSISTENCY_TYPE':'strong', 'MUTABILITY':'MUTABLE_LATEST'};
CREATE INDEX tbidx ON test_keyspace.tb (cn2);
INSERT INTO test_keyspace.tb (cn1, cn2, cn3) VALUES ('v11', 'v12', 'v13');
SELECT * FROM test_keyspace.tb WHERE cn2 = 'v12';

Available commands

After connecting, run HELP for a full reference. The following commands are available:

CategoryCommands
Shell commandsCAPTURE, COPY, DESCRIBE, DESC, EXIT, HELP, LOGIN, PAGING, SHOW
CQL help topicsALTER_KEYSPACE, ALTER_TABLE, ALTER_USER, ASCII, BATCH, BEGIN, BLOB, BOOLEAN, COUNTER, CREATE_COLUMNFAMILY, CREATE_INDEX, CREATE_KEYSPACE, CREATE_ROLE, CREATE_TABLE, CREATE_USER, DATE, DELETE, DROP_COLUMNFAMILY, DROP_INDEX, DROP_KEYSPACE, DROP_ROLE, DROP_TABLE, DROP_USER, GRANT, INSERT, INSERT_JSON, INT, JSON, KEYWORDS, LIST_PERMISSIONS, LIST_ROLES, LIST_USERS, PERMISSIONS, REVOKE, SELECT, SELECT_JSON, TEXT, TIME, TIMESTAMP, UPDATE, USE, UUID