9 Cassandra Shell Commands – You Must Know

1. Objective

In this Cassandra tutorial, we will study about the Cassandra shell commands used in CQLSH. Along with this, we will discuss different Cassandra Shell Commands: Help, Version, Color, No color, Debug, Execute, File, U, and P with syntax and example.
So, let’s Start with Cassandra Shell Commands.

9 Cassandra Shell Commands - You Must Know

9 Cassandra Shell Commands – You Must Know

2. Cassandra Shell Commands

Cassandra shell commands basically manipulate the cqlsh prompt window. Apart from this, shell commands help the user to perform various operations and display various documentation. CQLSH provide with many shell commands. 

Have a look at Cassandra Cluster

a. Help

This command is used to display the help documentation. Furthermore, this also helps the user to get a description of the cqlsh commands. The user can use ‘help’ keyword to perform the operation.
Do you know Major Difference & Similarities between HBase vs Cassandra
A Syntax of Help Command-

clqsh>HELP;

b. Version

There are a lot of versions of Cassandra that are upgraded since the development of the technology. This command provides the version of cqlsh the user is using.
A Syntax of Version Command-

cqlsh>VERSION;

c. Color

The user can use the colorful output for a better presentation. The user can use this command for the said purpose. To perform the operation ‘COLOR’ keyword can be used.
A Syntax of Color Command-

cqlsh>COLOR('<colour name>');

d. No Color

There might be a possibility that the user might want to change the color setting back to no color. For that, the user can use ‘NO COLOR’ keyword. This command directs cqlsh not to use colored output.
Let’s learn Cassandra Curd Operation – Create, Update, Read & Delete
A Syntax of No Color Command-

cqlsh>NO COLOR;

e. Debug

Debugging is detection and elimination of error in a code. CQLSH provides the user to show debugging information for a source code. The ‘DEBUG’ keyword is used to perform the said operation.
A Syntax of Debug Command-

cqlsh>DEBUG;

f. Execute 

CQLSH provides a command that executes a CQL command. The command first accepts the cql command. Then after accepting the command, it executes the command. ‘EXECUTE’ key word is used to perform the said operation. The CQL command is added to the ‘EXECUTE’ statement.

Do you know about Cassandra Troubleshooting
A Syntax of Execute Command-

cqlsh>EXECUTE <CQL_statements>;

g. File

CQLSH gives an advantage for the user to store the code in a file. That file can be executed using a SHELL COMMAND. This command lets the user to connect cqlsh with the file. ‘FILE’ keyword is used to perform the said operation in addition to the file name.
A Syntax of File Command-

cqlsh>FILE('<file name>');

h. U

Cassandra provides a special feature in which you can authenticate a user. The default name in Cassandra is ‘Cassandra’. Using ‘U’ keyword is used to assign a user.
Do You Know Why Cassandra Is So Popular?
A Syntax of U Command-

cqlsh>U<"user name">;

i. P

The user can assign a password to the authenticated user. Cassandra sets default password to be ‘Çassandra’. Using ‘P’ keyword user can set the password.
A Syntax of P Command- 

cqlsh>P<"password">;

So, this was all about Cassandra Shell Commands. Hope you like our explanation.

3. Conclusion

As a result, in this article, we get to know about Cassandra shell commands. In the next article, we will study the Documented Shell Commands. They are a bit similar, but the difference is of the documentation and the prompt window. Furthermore, If have any doubt, feel free to ask in the comment section.
Related Topic- Cassandra Architecture 
For reference 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.