Single Node Installation for Cassandra

Hi Cassandralearners,

This material helps you to install cassandra single node cluster in your machine. Follow the instructions and get cassandra installed and start working with cassandra.


1. We need to download cassandra. Try to use below link to download it or use wget. If you need latest version then go to cassandra official web Site

Download (apache-cassandra and Java)

2. We need jdk. Use below link to download jdk. If the link is broken then Please check for current version in the Oracle Site.


3. Untar the downloaded cassandra and downloaded jdk, then set javahome and cassandra path in bashrc

Following is the command for untar (decompress)
tar -zxvf apache-cassandra-2.1.4
tar -zxvf jdk1.7.0_45.tar.gz

.bashrc is a shell script that Bash runs whenever it is started interactively. You can put any command in that file that you could type at the command prompt. You put commands here to set up the shell for use in your particular environment, or to customize things to your preferences.

vi .bashrc
export JAVA_HOME=/home/bigdata/jdk1.7.0_79
export CASSANDRA_HOME=/home/bigdata/apache-cassandra-2.1.4

Create Directories
Create three directories in your apache cassandra home folder as given bellow.
data : The directory location where table data (SSTables) is stored.
Commitlog : The directory where the commit log is stored. For optimal write performance, it is recommended the commit log be on a separate disk partition (ideally, a separate physical device) from the data file directories.
saved_caches :The directory location where table key and row caches are stored.(Look below)

cd apache-cassandra-2.1.4
mkdir data
mkdir commitlog
mkdir saved_caches

After creating the directories edit the cassandra.yml (configuration file) as given below
vi conf/cassandra.yaml

data_file_directories:- /home/bigdata/apache-cassandra-2.1.4/data
# commit log
commitlog_directory: /home/bigdata/apache-cassandra-2.1.4/commitlog

# saved caches
saved_caches_directory: /home/bigdata/apache-cassandra-2.1.4/saved_caches

Open two terminal enter in to cassandra folder and follow the steps

Starting Cassandra

Start cassandra by using cassandra -f (Stand alone service) in terminal.Open a new terminal and check the cassandradaemon is running by give jps command.

terminal 1 —-> $ cassandra -f
terminal 2 —-> $ jps

Starting CQLSH (Cql shell)
Now start the cassandra cql shell in a separate terminal as given bellow.

terminal 3 —-> $ cqlsh

$ bin/cqlsh datadotz_node1

cqlsh> CREATE KEYSPACE datadotzdb WITH REPLICATION = {‘class’ :’SimpleStrategy’, ‘replication_factor’: 3};

cqlsh> select * from system.schema_keyspaces;

cqlsh> create table datadotzdb.patient(sno int primary key,pname varchar,drug varchar,gender varchar,amt int);

cqlsh> insert into datadotzdb.patient(sno,pname,drug,gender,amt)values(1,’saravanan’,'avil’,'male’,200);

cqlsh> insert into datadotzdb.patient(sno,pname,drug,gender,amt)values(2,’Ram’,'avil’,'male’,400);

cqlsh> select * from datadotzdb.patient;


Article written by DataDotz Team

DataDotz is a Chennai based BigData Team primarily focussed on consulting and training on technologies such as Apache Hadoop, Apache Spark , NoSQL(HBase, Cassandra, MongoDB), Search and Cloud Computing.

Note: DataDotz also provides classroom based Apache Kafka training in Chennai. The Course includes Cassandra , MongoDB, Scala and Apache Spark Training. For more details related to Apache Spark training in Chennai, please visit