database – Listar keyspaces no Cassandra

Question:

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 fine, it seems, but when I run the command :

sudo cassandra -f

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

so i try to start cassandra always super user privilege

cassandra -f

but I get an error 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 CQL Shell, which apparently was created successfully, but when I run the command:

cqlsh> DESCRIBE KEYSPACE

I get an answer:

Not in any keyspace

What am I doing wrong?

Answer:

You don't have any KEYSPACE defined yet, your book is probably out of date compared to the current version of CQL available in your installation, look for this reference from Datastax which is the current maintainer of Cassandra and CQL.

Take a look at the data model again and look at the CQL query operations.

To create your KEYSPACE:

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

To use your Keyspace:

USE seukeyspacenome;
Scroll to Top