Latest Post

Thursday, 22 December 2016

Best Ways to Create Cassandra Keyspace [Create]

Create Keyspace in Cassandra

All tables are grouped in keyspace. Keyspace name should be comprised of only alphanumeric characters and cannot be empty. KEYSPACE are limited in size to 48 characters.

Syntax
:- CREATE KEYSPACE [ IF NOT EXISTS ] keyspace_name WITH options

The supported options are
Name
Type
Mandatory
Default
Description
replication
map
yes

The replication strategy and options to use for the keyspace.
durable_writes
simple
no
TRUE
Whether to use the commit log for updates on this keyspace.

Example:-
cqlsh> CREATE KEYSPACE Customer WITH 
 replication = {'class': 'SimpleStrategy', 'replication_factor' : 3};
cqlsh> CREATE KEYSPACE Music WITH 
replication = {'class': 'NetworkTopologyStrategy', 'DC1' : 1, 'DC2' : 3}
    AND durable_writes = false;





Government Jobs