Apache Cassandra: an Introduction

Apache Cassandra is an open source big data database used for storing large volumes of structured data. It is originally based on the Facebook's Dynamo and Google's Big Table. Like other big data databases, Apace Cassandra is a NoSQL database; it is not a relational database like SQL Server.

Following are the key components that form the basis of the Apache Cassandra data model:

Keyspace: For easy understanding, it can be compared to a Database in RDBMS

Column Family: Similar to an RDBMS table

Column: A container for a row with no definite columnar schema

Partition Key: A key to identify the column

What's Special?

There are other big data databases, such as MongoDB, HBase, and so forth, but there are a few special characteristics for Cassandra. Here are a few of them:

Supports distributed architecture

The data can be distributed in a data center under a cluster of nodes.

It can be scaled up across multiple data centers.

There is no master/slave model. Each node does the same as its peer. It is a peer-to-peer model.

High availability: Each replication has a powerful failover mechanism.

Linearly scalable with zero downtime: Increase the throughput simply by adding an additional node without bringing down the system.

Try It Out on Windows

Mostly, .NET developers will have a Windows machine and they don't have to worry about trying out Cassandra on a Windows OS. You can download Casandra for Windows. It will work as a single node cluster.

Once the installation is complete, you will get the CQL Shell (Cassandra Query Language) tool for Cassandra. It is the current client console for working with the Cassandra database. Figure 1 shows the CQL shell.

Figure 2 shows the values selected using the SELECT query on the CQL shell.

Figure 2: Result of using the SELECT query

Use Cassandra in a .NET World

In this section, let us connect to the Casandra Keyspace that we created from a .NET framework console application. Create a Console Application and include the NuGet package CassandraCSharpDriver from DataStax. Add the following code in the Program.cs to connect to the demo keyspace.