Apache Cassandra

CQLSH Show

When working in the Cassandra Shell, you may encounter a scenario where you must gather basic information about your session, CQLSH, database, native protocol, and CQL specification versions.

In this article, we will cover a simple but practical command that allows you to fetch such information from the CQLSH session.

CQLSH Show Command

The show command allows you to show various information depending on the subsequent sub-command.

The command syntax is shown below:

SHOW VERSION | HOST | SESSION tracing_session_id

The command supports the following sub-commands:

  • VERSION – This shows version information for various resources, such as CQLSH, the database, native protocol, and the CQL specification
  • HOST – Shows node details for the session host
  • SESSION traccing_session_id – this option returns detailed information about the specific query in the tracing_session_id. Cassandra will store the session IDs in the system_traces.sessions tables

Example Command Usage

The following examples depict how to use the show command and the resulting output:

Log in to Cassandra:

$ cqlsh -u cassandra -p cassandra

To show the version information, run the following command:

cassandra@cqlsh> show version

Output:

[cqlsh 6.0.0 | Cassandra 4.0.6 | CQL spec 3.4.5 | Native protocol v5]

To show host information, run the following command:

cassandra@cqlsh> show host;

Example output:

Connected to Local Cluster at 127.0.0.1:9042

Show trace activity for a given session ID:

cassandra@cqlsh> show session 2dfe5880-3d8d-11ed-8065-ed32f09d596d;

The command should return tracing information for the session as shown in the sample output below:

You can get your session information from the sessions table, as shown below:

cassandra@cqlsh> select * from system_traces.sessions;

Example output:

Conclusion

This brief tutorial covered one of the CQLSH commands that allows us to fetch various information from the CQLSH session. The CQLSH Show command supports various sub-commands, such as Version and Host.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list