Apache Cassandra

Cassandra is a distributed database management system designed for handling a high volume of structured data across commodity servers. It provides high availability with no single point of failure.

Important points 

Apache Cassandra is an open source, distributed and decentralized/distributed storage system.
It is a column-oriented database.
Cassandra was developed at Facebook for inbox search.

FAULT TOLERANT:
Data is automatically replicated to multiple nodes for fault-tolerance. It supports replication across multiple data centers. This ensures the replacement of the failed nodes with no downtime.

DECENTRALIZED:
There are no single points of failure and network bottlenecks. Every node in the cluster is identical.

ELASTIC:
As new machines are added,  both the read and write throughput increase linearly with no downtime or interruption to applications.

Key components of Cassandra

Node − It is the place where data is stored.

Data center − It is a collection of related nodes.

Cluster − A cluster is a component that contains one or more data centers.

Commit log − The commit log is a crash-recovery mechanism in Cassandra. Every write operation is written to the commit log.

Mem-table − A mem-table is a memory-resident data structure. After commit log, the data will be written to the mem-table. Sometimes, for a single-column family, there will be multiple mem-tables.

SSTable − It is a disk file to which the data is flushed from the mem-table when its contents reach a threshold value.

Bloom filter − This is basically a data structure designed to tell us rapidly and memory-efficiently, whether an element is present in a set. It is a special kind of cache. Bloom filters are accessed after every query.

Data Replication

A node in a cluster act as replicas for a given piece of data. If it is detected that some of the nodes responded with an out-of-date value, Cassandra will return the most recent value to the client. After returning the most recent value, Cassandra performs a read repair in the background to update the stale values.


 

Installation

Java is the main prerequisite for Cassandra.We need to verify the java version using the below command.

============
#java –version
============

Installation from RPM packages

For the <release series> specify the major version number without dot, and with an appended x.
The latest <release series> is 311x.
For older releases, the <release series> can be one of 30x, 22x, or 21x.
(Not all versions of Apache Cassandra are available, since building RPMs is a recent addition to the project.)

Add the Apache repository of Cassandra to /etc/yum.repos.d/cassandra.repo. For the latest 3.11 version, see the below example:
===========
[cassandra] name=Apache Cassandra
baseurl=https://www.apache.org/dist/cassandra/redhat/311x/
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.apache.org/dist/cassandra/KEYS
===========

Install Cassandra, accepting the gpg key import prompts:
sudo yum install cassandra
Start Cassandra (will not start automatically):

service cassandra start

Download Cassandra

Download URL: http://cassandra.apache.org/download/

Important things related to Cassandra

By default, Cassandra uses the port 7000 for cluster communication (7001 if SSL is enabled), 9042 for native protocol clients, and 7199 for JMX. The internode communication and native protocol ports are configurable in the Cassandra Configuration File. The JMX port is configurable in cassandra-env.sh (through JVM options). All ports are TCP.
When a new node joins a cluster, it will automatically contact the other nodes in the cluster and copy the right data to itself. On RHEL nodes are unable to join the ring and the solution to this case is to check if SELinux is on; if it is, turn it off.

 

Leave a Reply