Alter Keyspace Cassandra

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

Cassandra Alter Keyspace

The "ALTER keyspace" command is used to alter the replication factor, strategy name and durable writes properties in created keyspace in Cassandra.




  1. ALTER KEYSPACE "KeySpace Name"  

  2. WITH replication = {'class': 'Strategy name', 'replication_factor' : 'No.Of  replicas'};   


  1. Alter Keyspace KeyspaceName with replication={'class':'StrategyName',   

  2.     'replication_factor': no of replications on different nodes}   

  3.         with DURABLE_WRITES=true/false   

Main points while altering Keyspace in Cassandra

  • Keyspace Name: Keyspace name cannot be altered in Cassandra.

  • Strategy Name: Strategy name can be altered by using a new strategy name.

  • Replication Factor: Replication factor can be altered by using a new replication factor.

  • DURABLE_WRITES: DURABLE_WRITES value can be altered by specifying its value true/false. By default, it is true. If set to false, no updates will be written to the commit log and vice versa.


Let's take an example to demonstrate "Alter Keyspace". This will alter the keyspace strategy from 'SimpleStrategy' to 'NetworkTopologyStrategy' and replication factor from 3 to 1 for DataCenter1.

  1. ALTER KEYSPACE javatpoint  

  2. WITH replication = {'class':'NetworkTopologyStrategy', 'replication_factor' : 1};