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 to Cassandra DB

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

  • For Cassandra 3.11.14 (Python 2.7):

    cqlsh -u <username> -p <password> <ip_address>
    
  • For Cassandra 4.0.3 / 4.1.3 (Python 3.x):

    python3 -m cqlsh <ip_address> -u <username> -p <password>
    

Note:
On systems like RHEL 7 where python points to Python 2.7 by default, you must use python3 to launch cqlsh when working with Cassandra 4.x, otherwise you'll encounter compatibility errors.

Useful Cassandra 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 to Cassandra DB

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

  • For Cassandra 3.11.14 (Python 2.7):

    cqlsh -u <username> -p <password> <ip_address>
    
  • For Cassandra 4.0.3 / 4.1.3 (Python 3.x):

    python3 -m cqlsh <ip_address> -u <username> -p <password>
    

Note:
On systems like RHEL 7 where python points to Python 2.7 by default, you must use python3 to launch cqlsh when working with Cassandra 4.x, otherwise you'll encounter compatibility errors.

Useful Cassandra 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