How to alter Cassandra Keyspace
In this article, I am going to show How to alter Cassandra Keyspace. ALTER KEYSPACE can be used to alter properties such as the number of replicas and the durable_writes of a KeySpace
Syntax
ALTER KEYSPACE <identifier> WITH <properties> ALTER KEYSPACE “KeySpace Name” WITH replication = {'class': ‘Strategy name’, 'replication_factor' : ‘No.Of replicas’};
Example
Existing keyspace details:
Keyspace name: narayanatutorial
Replication factor: 1
In the alter keyspace, changing the replication factor to 2.
ALTER KEYSPACE narayanatutorial WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : '2'}
Keyspace Commands
- CREATE KEYSPACE − Creates a KeySpace in Cassandra.
- ALTER KEYSPACE − Changes the properties of a KeySpace.
- DROP KEYSPACE − Removes a KeySpace
- USE – allows to change the current keyspace
References
http://cassandra.apache.org/doc/latest/cql/ddl.html#alter-keyspace
http://cassandra.apache.org/doc/latest/cql/ddl.html#
Hello! I am Narayanaswamy founder and admin of narayanatutorial.com. I have been working in the IT industry for more than 12 years. NarayanaTutorial is my web technologies blog. My specialties are Java / J2EE, Spring, Hibernate, Struts, Webservices, PHP, Oracle, MySQL, SQLServer, Web Hosting, Website Development, and IAM(ForgeRock) Specialist
I am a self-learner and passionate about training and writing. I am always trying my best to share my knowledge through my blog.