Site icon Narayana Tutorial

How to create Cassandra Keyspace

How to create Cassandra Keyspace

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

 

References

http://cassandra.apache.org/doc/latest/cql/ddl.html#create-keyspace

http://cassandra.apache.org/doc/latest/cql/ddl.html#