List keyspaces in Cassandra

Asked

Viewed 628 times

3

I need to learn how to use Apache Cassandra. I’m following a book called Cassandra: the ultimate guide - Jeffrey Carpenter. I managed to do the installation nicely, by the looks of it, but when I execute the command :

sudo cassandra -f

get as output:

Running Cassandra as root user or group is not recommended - please start Cassandra using a different system user.
If you really want to force running Cassandra as root, use -R command line option.

then I try to start the Super User Privilege always

cassandra -f

but I get a mistake saying :

Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file /var/log/cassandra/gc.log due to Permission denied

Also, I tried to create a keyspace through the CQL Shell, which apparently was created successfully, but when I run the command:

cqlsh> DESCRIBE KEYSPACE

answer:

Not in any keyspace

What am I doing wrong?

5 answers

0

You don’t have any KEYSPACE set yet, your book is probably outdated from the current version of CQL available in your installation, look for this datastax reference who is the current maintainer of Cassandra and CQL.

Read again about the data model and view query operations with CQL.

To create your KEYSPACE:

CREATE KEYSPACE seukeyspacenome WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'datacenter1' : 3 };

To use your Keyspace:

USE seukeyspacenome;

0

[cqlsh 5.0.1 | Cassandra 3.11.6 | CQL spec 3.4.4 | Native Protocol v4] Use HELP for help.

cqlsh> desc keyspaces;

0

To list all keyspaces in the process just use the following query:

SELECT * FROM system_schema.keyspaces;

0

@roooooon Get yourself Not in any keyspace in the execution of this command, because of the syntax error:

DESCRIBE KEYSPACE

Have you forgotten the "s" and the ";" in the end

The correct way to List keyspaces/keynote is:

 cqlsh> DESCRIBE keyspaces;

The result will be:

 system_schema system system_auth system_distributed system_traces

hope I’ve helped!

-1

To List Keyspaces:

DESCRIBE keyspaces;
  • In the question the author says that the command already results in error Not in any keyspace

  • Uma vez que a instalação é bem feita, o resultado seria este: cqlsh> Describe keyspaces;

system_schema system 
system_auth system_distributed system_traces

cqlsh>

  • He made a syntax error, writing DESCRIBE KEYSPACE that the correct is DESCRIBE keyspaces;

  • put this in the answer, which was a syntax error

Browser other questions tagged

You are not signed in. Login or sign up in order to post.