How to create Cassandra Keyspace
Table of Contents
In this article, I am going to show How to create Cassandra Keyspace. A keyspace in Cassandra is a namespace that defines data replication on nodes. A cluster contains one keyspace per node.
Syntax
CREATE KEYSPACE <identifier> WITH <properties> CREATE KEYSPACE “KeySpace Name” WITH replication = {'class': ‘Strategy name’, 'replication_factor' : ‘No.Of replicas’};
Example:
CREATE KEYSPACE narayanatutorial WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : '1'};
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#create-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.