Cassandra Basic Commands

Fabric uses the Cassandra DB as a storage layer. CQL commands can be run to check Cassandra tables on Fabric keyspaces.

Login Cassandra DB

Use the following command to connect to the Cassandra DB from the Cassandra server:

cqlsh -u <username> -p <password> <ip_address>;

Note that if the ip_address is not populated, the login command connects to the local host of the Fabric server.

Cassandra Useful Commands

The following table holds useful cqlsh commands.

For more information, see https://docs.datastax.com/en/cql-oss/3.x/cql/cql_reference/cqlCommandsTOC.html.

Command Name

Command Description

Examples

HELP

Get information about the list of Cassandra commands or a specific Cassandra command.

  • Help describe;

USE

Move to a specific keyspace

  • Use k2view_customer;

DESCRIBE (shorthand: DESC)

Describe Cassandra objects.

Note that the Describe command is run in a keyspace and returns information about the objects in the keyspace.

 For more information, see:

https://docs.datastax.com/en/cql-oss/3.x/cql/cql_reference/cqlshDescribe.html

  • desc keyspaces, returns the list of keyspaces in the Cassandra cluster.
  • desc tables, returns the list of Cassandra keyspaces and the related tables of each keyspace.
  • desc schema, returns the details of all non-system objects in the Cassandra cluster.
  • desc keyspace <keyspace name>, returns the details of the specified keyspace and objects it contains.

EXIT/QUIT

Exit Cassandra

 

Run CQLSH on Local Cassandra

The Fabric Studio Debug Panel can be used to start, stop and open the local Cassandra Console. Alternatively, do the following:

  • Run queries on Cassandra in the Fabric server using the cql command.
  • Define a Cassandra DB interface in the Fabric Studio and set the host to localhost. Set the user and password to cassandra. Then open the Query Builder to view the list of Cassandra keyspaces and run SQL queries on Cassandra tables.

Previous

Cassandra Basic Commands

Fabric uses the Cassandra DB as a storage layer. CQL commands can be run to check Cassandra tables on Fabric keyspaces.

Login Cassandra DB

Use the following command to connect to the Cassandra DB from the Cassandra server:

cqlsh -u <username> -p <password> <ip_address>;

Note that if the ip_address is not populated, the login command connects to the local host of the Fabric server.

Cassandra Useful Commands

The following table holds useful cqlsh commands.

For more information, see https://docs.datastax.com/en/cql-oss/3.x/cql/cql_reference/cqlCommandsTOC.html.

Command Name

Command Description

Examples

HELP

Get information about the list of Cassandra commands or a specific Cassandra command.

  • Help describe;

USE

Move to a specific keyspace

  • Use k2view_customer;

DESCRIBE (shorthand: DESC)

Describe Cassandra objects.

Note that the Describe command is run in a keyspace and returns information about the objects in the keyspace.

 For more information, see:

https://docs.datastax.com/en/cql-oss/3.x/cql/cql_reference/cqlshDescribe.html

  • desc keyspaces, returns the list of keyspaces in the Cassandra cluster.
  • desc tables, returns the list of Cassandra keyspaces and the related tables of each keyspace.
  • desc schema, returns the details of all non-system objects in the Cassandra cluster.
  • desc keyspace <keyspace name>, returns the details of the specified keyspace and objects it contains.

EXIT/QUIT

Exit Cassandra

 

Run CQLSH on Local Cassandra

The Fabric Studio Debug Panel can be used to start, stop and open the local Cassandra Console. Alternatively, do the following:

  • Run queries on Cassandra in the Fabric server using the cql command.
  • Define a Cassandra DB interface in the Fabric Studio and set the host to localhost. Set the user and password to cassandra. Then open the Query Builder to view the list of Cassandra keyspaces and run SQL queries on Cassandra tables.

Previous