Tuesday, 24 July 2018

9 Cassandra Shell Commands

9 Cassandra Shell Commands

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. 

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.
A Syntax of Help Command-
  1. 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-
  1. 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-
  1. 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.
A Syntax of No Color Command-
  1. 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-
  1. 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.
A Syntax of Execute Command-
  1. 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-
  1. 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.
A Syntax of U Command-
  1. 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- 
  1. 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.

0 comments:

Post a Comment