C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Cassandra Alter KeyspaceThe "ALTER keyspace" command is used to alter the replication factor, strategy name and durable writes properties in created keyspace in Cassandra. Syntax: ALTER KEYSPACE <identifier> WITH <properties> Or
ALTER KEYSPACE "KeySpace Name"
WITH replication = {'class': 'Strategy name', 'replication_factor' : 'No.Of replicas'};
Or
Alter Keyspace KeyspaceName with replication={'class':'StrategyName',
'replication_factor': no of replications on different nodes}
with DURABLE_WRITES=true/false
Main points while altering Keyspace in Cassandra
Example: 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.
ALTER KEYSPACE TheDeveloperBlog
WITH replication = {'class':'NetworkTopologyStrategy', 'replication_factor' : 1};
Next TopicCassandra drop keyspace
|