Use and configure the Cassandra Query Language (CQL) shell (cqlsh)
Objective
The main way that you interact with DataStax Enterprise (DSE) 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
-
DataStax Enterprise (DSE) is installed and running.
Location and how to run cqlsh
The cqlsh
command is located in the bin
directory of the DSE 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
Connected to dse-6.9.0-early-preview-cluster at 127.0.0.1:9042.
[cqlsh 6.8.0 | DSE 6.9.0-early-preview | CQL spec 3.4.5 | DSE protocol v2]
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.8.0 | DSE 6.9.0 | CQL spec 3.4.5 | DSE protocol v2]
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>"