What You’ll Learn: How to use Cassandra Query Language (CQL) – a SQL (Structured Query Language)-like language for querying Cassandra – to view and modify properties of the database.

 

 

  • From the CQL shell, type:

cqlsh> DESC KEYSPACES;

 

you should see:

system videodb system_traces

 

Lets have look at the keyspace “videodb”

cqlsh> DESC KEYSPACE videodb;

 

  • Change the replication strategy on you instance in CQL using the ALTER command

cqlsh> ALTER KEYSPACE videodb WITH REPLICATION =
{ 'class' : 'SimpleStrategy', 'replication_factor' : 3 };

We have changed the replication factor from 1 to 3.

 

We can also modify the properties of a table

cqlsh> USE videodb;

  • to change the properties that were established during the creation of a table, use ALTER TABLE command.

cqlsh> ALTER TABLE videos
WITH comment = 'My video database'
AND read_repair_chance = 0.2;

 

Let’s change the compression properties of our table. Changing these will erase all previous compression/ settings already established

cqlsh> ALTER TABLE videos
WITH compression =</strong>
{ 'sstable_compression' : '' };

 

To make changes take effect, in the root console type:

# nodetool upgradesstables