This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing a list of important CQL shell commands of the Cassandra.
Get the help of all commands:
1 |
cassandra@cqlsh:dbrnd> help |
Check the host and version:
1 2 3 4 |
cassandra@cqlsh:dbrnd> show host Connected to Test Cluster at 127.0.0.1:9042. cassandra@cqlsh:dbrnd> show version [cqlsh 5.0.1 | Cassandra 3.5 | CQL spec 3.4.0 | Native protocol v4] |
Check the cluster information:
1 2 3 4 5 6 7 8 9 |
cassandra@cqlsh:dbrnd> describe cluster; Cluster: Test Cluster Partitioner: Murmur3Partitioner Range ownership: 7198801157164107876 [127.0.0.1] -6388269565477727734 [127.0.0.1] -13424558412243369 [127.0.0.1] |
Check the keyspaces:
1 2 3 4 |
cassandra@cqlsh:dbrnd> describe keyspaces; tutorialspoint system_auth dbrnd test system_schema system system_distributed system_traces |
Check the user defined tables:
1 2 3 |
cassandra@cqlsh:dbrnd> describe tables; tbl_employee tbl_department users |
Check the user defined types:
1 2 3 |
cassandra@cqlsh:dbrnd> describe types sports_details sport |
Check the consistency level:
1 2 |
cassandra@cqlsh:dbrnd> consistency Current consistency level is ONE. |
Make your table output expanded:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
cassandra@cqlsh:dbrnd> expand on Now Expanded output is enabled cassandra@cqlsh:dbrnd> select *from tbl_employee; @ Row 1 --------------+-------- empid | 1 empfirstname | Anvesh emplastname | Patel empsalary | 50000 @ Row 2 --------------+-------- empid | 2 empfirstname | Neevan emplastname | Patel empsalary | 150000 (2 rows) |