Cassandra database from entry to proficiency series six: view key space, create key space, create table, insert data

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.

  1. 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.

  2. After successfully starting cqlsh, you will see the CQL prompt (cqlsh>).

  3. Enter the following command to list all keyspaces:

    DESCRIBE KEYSPACES;
    

    You will see a list with all the keyspaces in the Cassandra database.

  4. To view details for a specific keyspace, you can use the following command, replacing your_keyspace_namewith the name of the keyspace you want to view:

    DESCRIBE KEYSPACE your_keyspace_name;
    

    You will see the details of the keyspace

Guess you like

Origin blog.csdn.net/zhengzaifeidelushang/article/details/131743565