Use and configure the Cassandra Query Language (CQL) shell (cqlsh)
Objective
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
-
Hyper-Converged Database (HCD) 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.
Running cqlsh
To run cqlsh
locally
No IP address is required when running cqlsh
locally.
bin/cqlsh
Results
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>
To run cqlsh
remotely
To run cqlsh
, you’ll specify the IP address of a node in the cluster.
bin/cqlsh 10.0.0.1
Results
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>
To use 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.
Using the cqlshrc
file for configuration
bin/cqlsh CQLSHRC="~/<directory_name>"