Use and configure the Cassandra Query Language (CQL) shell (cqlsh)
The main way that you interact with Hyper-Converged Database (HCD) is through the CQL shell (cqlsh
), a Python-based command-line shell for accessing the database and issuing CQL (Cassandra Query Language) commands.
This tutorial shows you how to configure and use cqlsh
.
Prerequisites
-
Mission Control is installed and running.
Location and how to run cqlsh
The cqlsh
command is located in the bin
directory of the HCD installation.
If you install the standalone cqlsh
, the command is located in the bin
directory where the download file is extracted, or unzipped.
Run cqlsh
To run cqlsh
locally
No IP address is required when running cqlsh
locally.
bin/cqlsh
Result
Connected to Test Cluster at 127.0.0.1:9042
[cqlsh 6.2.0 | Cassandra 5.0 | CQL spec 3.4.7 | Native protocol v5]
Use HELP for help.
cqlsh>
Run cqlsh
remotely
To run cqlsh
, you’ll specify the IP address of a node in the cluster.
bin/cqlsh 10.0.0.1
Result
Connected to Test Cluster at 10.0.0.1:9042
[cqlsh 6.2.0 | Cassandra 5.0 | CQL spec 3.4.7 | Native protocol v5]
Use HELP for help.
cqlsh>
Set a username and password
If you use security features, provide the username and password to authenticate with the database:
bin/cqlsh -u jane -p ScoobiePeanut&!
Get cqlsh
help menu
bin/cqlsh --help
There are a number of options that can be used with cqlsh
.
For a complete list of options, see the cqlsh reference page.
Configure cqlsh
with the cqlshrc
file
bin/cqlsh CQLSHRC="~/<directory_name>"