Apcahe Cassandra is one the most popular No Sql database to manage large amount of structured, semi structures and un structured data across multiple data centers and the cloud. Cassandra is a write friendly nosql database to provide linear scalability, continuous availability and implementable simplicity across many commodity servers with no single point of failure.

Apache Cassandra Single Node cluster

For production environments we strongly recommend to use a multi-node cluster, that is what Cassandra actually made for. In this article we will show how to install a single node Cassandra cluster on linux to for testing.

Step 1: Install Java

Cassandra needs a running Java on the machine, make sure you have installed Java 8+ and that's working fine:

java -version
echo $JAVA_HOME

Cassandra 3 or later requires Java 8+, You should see following output

java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

If Java is not installed please follow this link to install Java first: Install Java on Ubuntu.

Step 2: Download Cassandra

Download latest version of Cassandra tar,gz file and unzip it in a folder of your choice as shown below:

mkdir cassandra
cd cassandra
wget http://www.eu.apache.org/dist/cassandra/3.0.0/apache-cassandra-3.0.0-bin.tar.gz

You should see somwthing like this, indicating that the file is being downloaded:

--2015-11-22 00:49:25-- http://www.eu.apache.org/dist/cassandra/3.0.0/apache-cassandra-3.0.0-bin.tar.gz
Resolving www.eu.apache.org (www.eu.apache.org)... 88.198.26.2, 2a01:4f8:130:2192::2
Connecting to www.eu.apache.org (www.eu.apache.org)|88.198.26.2|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 30706232 (29M) [application/x-gzip]
Saving to: "apache-cassandra-3.0.0-bin.tar.gz"

Unzip the downloaded file with following command:

tar -xvzf apache-cassandra-3.0.0-bin.tar.gz

Now start cassandra by going to bin folder as shown below:

cd apache-cassandra-3.0.0/bin/
sudo sh cassandra

If everything goes fine you should see, something as shown below at the end of logs:

INFO 20:16:04 Node localhost/127.0.0.1 state jump to normal

Thats it, we are done with installing single node Cassandra cluster and started it.

Step 3: Connect with shell script or cqlsh

Noe lets test our installation by connected to shell script commands, do supply following command under bin folder:

./cqlsh

You should see following output:

Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.0.0 | CQL spec 3.3.1 | Native protocol v4]
Use HELP for help.
cqlsh>

That's it, we are done will installing a single node Cassandra cluster in Ubuntu, In next articles we will setup multi node cluster.
  • By Techburps.com
  • Nov 22, 2015
  • Cassandra