Connect to Hyper-Converged Database (HCD) with cqlsh
To use the command line tool cqlsh to connect to Hyper-Converged Database (HCD) and test any feature such as vector search, use the correct version.
Prerequisites
-
Python 3.6+
cqlsh connection methods in HCD
Depending on your installation, you have the following options to access cqlsh:
-
Use Mission Control to run
cqlsh. -
Use the version bundled with the tarball.
-
Use the version bundled with the HCD Docker container.
-
Mission Control
-
Tarball installations
-
Docker installations
Mission Control provides a web-based interface for managing your HCD clusters. DataStax recommends using Mission Control to manage your clusters and perform cluster operations. For more information, see Use the CQL console to interact with the databases in your datacenter in the Mission Control documentation.
If you have installed HCD from the tarball, you can find the cqlsh script in the bin directory of the HCD installation directory.
If you are using the HCD Docker container, you can run the cqlsh script inside the container.
The script is located in the bin directory of the HCD installation directory.
Connect to HCD with cqlsh
There are multiple ways to connect to cqlsh depending on your installation type and cluster configuation.
Connect to the built-in cqlsh in Mission Control
To use the built-in cqlsh in Mission Control, see Use the CQL console to interact with the databases in your datacenter in the Mission Control documentation.
Connect locally
To connect to a local cqlsh installation, start cqlsh in your terminal:
bin/cqlsh
If cqlsh starts properly, it prints the version numbers and the cqlsh command prompt:
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>
If cqlsh fails to connect and shows a port other than 9042, check your ~/.cassandra/cqlshrc file.
This file can alter the default settings for your cqlsh connection.
Connect remotely
To connect to a remote HCD cluster, 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>
Connect with authentication
If you use security features, provide the username and password to authenticate with the database:
bin/cqlsh -u jane -p ScoobiePeanut&!
Configure cqlsh with the cqlshrc file
bin/cqlsh CQLSHRC="~/<directory_name>"
Help and options for cqlsh
Use --help to get help information for cqlsh:
bin/cqlsh --help
You can use several options with cqlsh.
For a complete list of options, see the cqlsh reference page in the CQL documentation.