Cassandra database from entry to proficiency series six: view key space, create key space, create table, insert data
1. View the keyspace
To view the keyspaces (keyspaces) in the Cassandra database, you can use the CQL (Cassandra Query Language) command-line tool cqlsh.
-
Open a terminal, and enter the following command to start cqlsh:
cqlsh ip 9042
If cqlsh is not in the system path, please provide the full path to the cqlsh executable.
-
After successfully starting cqlsh, you will see the CQL prompt (cqlsh>).
-
Enter the following command to list all keyspaces:
DESCRIBE KEYSPACES;
You will see a list with all the keyspaces in the Cassandra database.
-
To view details for a specific keyspace, you can use the following command, replacing
your_keyspace_name
with the name of the keyspace you want to view:DESCRIBE KEYSPACE your_keyspace_name;
You will see the details of the keyspace