Altering a Keyspace - Cassandra

Author: Al-mamun Sarkar Date: 2020-09-19 14:05:04

Altering Keyspace is needed when you need to update REPLICATION or DURABLE_WRITES. 

 

Alter Keyspace:

Syntax:

ALTER KEYSPACE  WITH 
ALTER KEYSPACE "KeySpace_Name"
WITH REPLICATION = {'class': "Strategy_name", 'replication_factor' : "Number of replicas"}
AND DURABLE_WRITES = true;

Example:

ALTER KEYSPACE test_keyspace 
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 3} 
AND DURABLE_WRITES = true;