/    /  Cassandra – Cqlsh

Cassandra – Cqlsh

CQL – Cassandra Query Language is the language to communicate with Cassandra Database.
CQLSH – This is the Command Line Utility used to execute the commands to communicate with Cassandra database.

To start the utility we need to give the command cqlsh either in linux terminal or windows command prompt. The default listen port for cqlsh is 9042.

Syntax:

cqlsh [options] [host [port]]

Example:

casa@casa1:~$ cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.10 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh>

Note: Before starting the utility, you need to check if the Cassandra Path to bin directory is configured or not.

Below is an example to start cqlsh with authentication

cqlsh 192.168.2.101 9042 -u admin -p admin

To terminate the command we need to use the semicolon where as a new line will not terminate the command rather it is used to spread the program or commands across multiple lines for more clarity and indentation.