Cassandra
How to Download & Install Cassandra on Windows
Apache Cassandra is used by smaller organizations while Datastax enterprise is used by the larger...
In this article, you will learn-
A keyspace is an object that holds the column families, user defined types. In Cassandra, Keyspace is similar to RDBMS Database. Keyspace holds column families, indexes, user defined types, data center awareness, strategy used in keyspace, replication factor, etc.
Command "Create Keyspace" is used to create keyspace in Cassandra.
Syntax
Create keyspace KeyspaceName with replication={'class':strategy name,
'replication_factor': No of replications on different nodes};Various Components of Cassandra Keyspace
Create keyspace University with replication={'class':SimpleStrategy,'replication_factor': 3};After successful execution of command "Create Keyspace", Keyspace University will be created in Cassandra with strategy "SimpleStrategy" and replication factor 3.
Command "Alter Keyspace" alters the replication factor, strategy name and durable writes properties in created keyspace in Cassandra.
Syntax
Alter Keyspace KeyspaceName with replication={'class':'StrategyName',
'replication_factor': no of replications on different nodes}
with DURABLE_WRITES=true/falseKey aspects while altering Keyspace in Cassandra
Alter Keyspace University with replication={'class':'NetworktopologyStrategy', 'DataCenter1':1};After successful execution of the command "Alter Keyspace", Strategyname will be changed from 'SimpleStrategy' to 'NetworkTopologyStrategy' and replication factor will be changed from 3 to 1 for 'DataCenter1.'
Command 'Drop Keyspace' drops keyspace including all the data, column families, user defined types and indexes from Cassandra. Before dropping the keyspace, Cassandra takes a snapshot of the keyspace. If keyspace does not exist in the Cassandra, Cassandra will return an error unless IF EXISTS is used.
Syntax
Drop keyspace KeyspaceName
Example
Here is the snapshot of the executed command 'Drop Keyspace' that will drop keyspace University.
Drop keyspace University;
After successful execution of the command 'Drop keyspace University', keyspace University will be dropped from Cassandra with all the data and schema.
Here is the snapshot where the error is returned when tried to access keyspace that does not exist.
Note: There is no difference in drop keyspace and delete keyspace. Drop keyspace is equal to delete keyspace.
Apache Cassandra is used by smaller organizations while Datastax enterprise is used by the larger...
$20.20 $9.99 for today 4.6 (119 ratings) Key Highlights of Cassandra PDF 94+ pages eBook Designed...
Although Cassandra query language resembles with SQL language, their data modelling methods are...
There are two types of security in Apache Cassandra and Datastax enterprise. Internal...
Cassandra is designed to handle big data. Cassandra’s main feature is to store data on multiple...
Cassandra Create Index Command 'Create index' creates an index on the column specified by the...