Connect to HCD with the CQL shell (cqlsh)
The CQL shell (cqlsh) is a Python-based command-line shell you can use to issue Cassandra Query Language (CQL) statements to your Hyper-Converged Database (HCD) databases.
The CQL shell also provides unique cqlsh commands like DESCRIBE KEYSPACE.
These steps are for running the CQL shell on the command line. If you are using the Mission Control CQL console, see Use the CQL console to interact with the databases in your datacenter for usage instructions.
Start the CQL shell and connect to a node
Start cqlsh from the directory where it is installed.
For example, for the tarball-bundled CQL shell, run cqlsh from the bin directory of your HCD installation:
bin/cqlsh
Starting cqlsh with no arguments attempts to connect to the local node without authentication.
To connect to a remote node, provide the IP address of the target node:
bin/cqlsh IP_ADDRESS
If the node requires authentication, provide the required credentials. The following example uses internal username and password authentication.
bin/cqlsh IP_ADDRESS -u DATABASE_ROLE_NAME -p DATABASE_ROLE_PASSWORD
|
Credentials passed on the command line can be stored in your shell history.
To avoid this, pass only the |
Use a cqlshrc file
As an alternative to command line arguments, you can store these values in a cqlshrc file that cqlsh reads automatically at startup.
For more information, see Use a cqlshrc file.
Run commands with the CQL shell
A successful connection shows the connection details and the cqlsh prompt:
Connected to hcd-cluster at 192.0.2.200:9042
[cqlsh 6.1.0 | Cassandra 4.1.x | CQL spec 3.4.6 | Native protocol v5]
Use HELP for help.
cqlsh>
At the cqlsh prompt, issue CQL or cqlsh commands.
Troubleshoot the CQL shell
If cqlsh cannot connect, and it mentions a different port than 9042, make sure your ~/.cassandra/cqlshrc file isn’t modifying the default port.
For command help, run cqlsh --help.
For detailed logs, start cqlsh or run any cqlsh command with the --debug option.