/  Cassandra Tutorial

Cassandra Introduction

Apache Cassandra is NoSQL database distributed management system which is free and open-source. Cassandra is originally developed at Facebook and it was released as open-source in google code, later apache taken as incubator project for further development. Without compromising on performance, Cassandra can provide great linear scalability and high availability.

Who can Learn ?

Software professionals who have basic RDBMS knowledge and interested to learn this NoSQL database technology can be benefitted through this tutorial with many basic operations which can be performed.

Prerequisites

Basic RDBMS knowledge is required to start with this technology. This database is being used along with big data technologies and where the high scalability and performance is needed.

So, Let’s have a quick view of cassandra tutorial…

Understanding Relational vs NoSQL:

NoSQL databases differ from RDBMS technology in four main areas such as Data model, Data structure, Scaling, Usage cost.NoSQL or ‘Not only SQL’ is a non-relational database. It supports a very simple query language with no fixed schema. Learn more..

How Architecture is designed in cassandra?

Cassandra is a Ring based model designed for Bigdata applications, where data is distributed across all nodes in the cluster evenly using consistent hashing algorithm with no single point of failure.In Cassandra, multiple nodes that forms a cluster in a datacentre which communicates with all nodes in other datacenters using gossip protocol. Learn more..

Understanding Column Family in cassandra:

It is a NoSQL format which contains columns of key-value pair, where the key is mapped to value. Generally, In relational databases we will work with tables in which every key-value pair is a row.In NoSQL each column is a tuple (Triplet) consists of column name , value and timestamp. whereas in RDBMS this data will be in the form of table.  Learn more..

What are the components in cassandra?

There are many such as, Node is a server/system where data is stored.Data Center:A Collection of nodes are called as Data center.Data center may be physical or virtual. Datacenters should never span physical locations.Cluster: It contains one or more data centers which can span physical locations. Learn more..

How to install Cassandra?

Before Installation of Cassandra , we need to go through some prerequisites. Below are the steps provided to install Cassandra on Linux environments.Ensure that you have latest version of Java. Java 1.8 and Python 2.7 Learn more..

Understanding Data Models in cassandra:

Cassandra data model was clearly explained with detailed pictorial representations as below.Column is a Key-value pair which also contains a time-stamp along with it. A Super ColumnColumn that contains one or more columns (Array of columns) can be called as Super Column. Learn more..

What are the Data Types in Cassandra?

In this tutorial, we will learn about the Data Types in Cassandra CQL language. DataTypes generally define the type of data a column can hold along with their own significance. CQL language supports the below list Data types:Native Types, Collection Types, User-defined Types, tuple types. Learn more..

Understanding Cqlsh in Cassandra:

CQLSH – This is the Command Line Utility used to execute the commands to communicate with Cassandra database.To start the utility we need to give the command cqlsh either in linux terminal or windows command prompt. The default listen port for cqlsh is 9042. Learn more..

Understanding Cqlsh Commands in cassandra:

In this tutorial, we will learn about the cqlsh commands. In Cassandra, cqlsh commands can be used through CQL interactive terminal. These commands will work only within the Cqlsh shell. Learn more..

How to Create KeySpace in cassandra?

KeySpace in NoSQL database is just like a schema in regular RDBMS concept, Anyhow it does not have any concrete structure. In NoSQL database, there will be one keyspace per application.A Keyspace contains column families or super columns. Each super column contains one or more column family, each column family contains at least one column. Learn more..

How to Alter Key Space in cassandra?

Alter Keyspace command allows you to alter the replicaton factor, strategy name and durable writes attributes. Below the syntax for Alter KeySpace command.Using Alter command Keyspace Name cannot be changed in cassandra. Learn more..

How to Drop Key Space in cassandra?

In this tutorial, we will learn about the DROP Keyspace command which allows you to drop the keyspace which includes all the data, column families,UTD,indexes from cassandra. Learn more..

How to Create Table in cassandra?

In this tutorial, we will learn about the CREATE Table command in Cassandra which allows us to create new table using cqlsh by providing the valid column names, data types.Compounded PrimaryKey consists more than one column as primary key. Cassandra treats the first column as partition key. Learn more..

How to Alter Table in cassandra?

Using Alter Table command you can change the data type of column, can add or remove the columns to existing table and change table properties too. Learn more..

How to Drop Table in cassandra?

Drop table can be used to drop the table.Before giving this command , you should check that if you are in proper keyspace and you are dropping the exact table what you want.Validate,
If the table get deleted , then you should not be able to see the table name after giving the below command in the respective KeySpace. Learn more..

How to Truncate Table in cassandra?

In this tutorial, we will learn about TRUNCATE Table command in Cassandra which will allow to truncate all the data from a table. The Date removed is irreversible.Truncating a table triggers an automatic snapshot which backs up the data only, not the schema. Learn more..

How to Insert Data in cassandra?

Insert command allows us to creat or insert the data records into the columns. Here it is not required to define all columns and all those missing columns will get no space on disk.So if columns Exists, it is updated. Learn more..

How to Update Data in cassandra?

Update Command allows us to update the one or more columns values in cassandra table. To update the multiple columns , we need to seperate the name-value pairs using commas. Learn more..

How to Delete Data in cassandra?

In this tutorial, we will learn about the DELETE command in Cassandra which allows to remove one or more columns data in a table and also it removes entire row if no column is specified. Learn more..

How to Select data in cassandra?

In this tutorial, we will learn about the SELECT command in Cassandra which is used to retrieve the data from the cassandra table. We can perform various projections using the SELECT statement.Select Expression will be given as input to the select statement, where the output depends on the select expression. Learn more..

How to Create Index in cassandra?

Create Index command allows to create new index on the specified column for a table. Cassandra indexes the data during the execution of command and also the new data that is being inserted once after the creation of index. Learn more..

How to Drop Index in cassandra?

A DROP INDEX command allows us to drop the existing index. If the index was not given a name during creation, the index name is <table_name>_<column_name>_idx. Learn more..

Understanding Collection Types in cassandra:

Collections provide the simplest way to handle multiple tasks.The maximum size of an item in collection is 64K. Also it is advisable to keep collections small to avoid delay during query execution.Even though if you insert more than 64K data that will result into dataloss, because only 64K is queryable. Learn more..

Understanding Batch command in cassandra:

In tutorial, we will learn about the Batch command in Cassandra which allows us to write multiple DML statements in a single shot. DML statements include the Insert, Update, Delete commands. Learn more..