Site icon Tutorial

Installation of Apache Cassandra

Certify and Increase Opportunity.
Be
Govt. Certified Apache Cassandra Professional

Installation of Apache Cassandra

Installation of Casandra involves two steps – download and install as

Step 1: Download Cassandra

Step 2: Basic Configuration
The Cassandra configuration files can be found in the conf directory of binary and source distributions. If you have installed Cassandra from a deb or rpm package, the configuration files will be located in /etc/cassandra.

Platform specific installation is discussed as –

Cassandra installation on Windows 7
1. Cassandra is java based application, so first of all you need to install java on your machine. Latest JRE you can download from here: http://www.oracle.com/technetwork/java/javase/downloads/index.html

2. Download Cassandra binary files from here: http://cassandra.apache.org/download/

3. Extract Cassandra source files. e.g. to D:\cassandra

4. set environment variables. (Go to  System Properties -> Tab Advanced -> button Environment Variables … and add system variables here)
JAVA_HOME=c:\Program Files\Java\jre6\ (it should be path to jre directory, not to bin directory … value I used can be different on your machine)
CASSANDRA_HOME=d:\cassandra

5. modify config file d:\cassandra\conf\storage-conf.xml A sample changes are as :

<CommitLogDirectory>/var/lib/cassandra/commitlog</CommitLogDirectory>

to

<CommitLogDirectory>d:/cassandra/commitlog</CommitLogDirectory>

also I created directory d:/cassandra/commitlog

Next change was:

/var/lib/cassandra/data

I changed it to

<DataFileDirectory>d:/cassandra/data</DataFileDirectory>

and again I created directory d:/cassandra/data

6. You are ready to start Cassandra. Go to directory d:\cassandra\bin\ and start cassandra.bat

You should see output like this:

D:\cassandra\bin>cassandra.bat
Starting Cassandra Server
Listening for transport dt_socket at address: 8888
INFO 13:47:17,274 DiskAccessMode ‘auto’ determined to be mmap, indexAccessMode
is mmap
INFO 13:47:17,808 Saved Token not found. Using 15738447088364600050102917327157
1041806
INFO 13:47:17,809 Saved ClusterName not found. Using Test Cluster
INFO 13:47:17,815 Creating new commitlog segment d:/cassandra/commitlog\CommitL
og-1280922437815.log
INFO 13:47:17,886 LocationInfo has reached its threshold; switching in a fresh
Memtable at CommitLogContext(file=’d:/cassandra/commitlog\CommitLog-128092243781
5.log’, position=419)
INFO 13:47:17,903 Enqueuing flush of Memtable-LocationInfo@1370440457(169 bytes
, 4 operations)
INFO 13:47:17,905 Writing Memtable-LocationInfo@1370440457(169 bytes, 4 operati
ons)
INFO 13:47:18,082 Completed flushing d:\cassandra\data\system\LocationInfo-1-Da
ta.db
INFO 13:47:18,122 Starting up server gossip
INFO 13:47:18,196 Binding thrift service to localhost/127.0.0.1:9160
INFO 13:47:18,204 Cassandra starting up…


 Installing Apache Cassandra on Ubuntu 12.04

view plainprint?
sudo apt-get update
sudo apt-get upgrade

view plainprint?
sudo gedit /etc/apt/sources.list

view plainprint?
deb http://www.apache.org/dist/cassandra/debian 10x main
deb-src http://www.apache.org/dist/cassandra/debian 10x main

view plainprint?
GPG error: http://www.apache.org unstable Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 4BD736A82B5C1B00

view plainprint?
gpg –keyserver wwwkeys.pgp.net –recv-keys 4BD736A82B5C1B00
sudo apt-key add ~/.gnupg/pubring.gpg
sudo apt-get update

view plainprint?
sudo apt-get install cassandra

view plainprint?
sudo cassandra -f

Installation will create following directories. Uses of them are mentioned within the brackets.

/var/lib/cassandra (data directories)
/var/log/cassandra (log directory)
/var/run/cassandra (runtime files)
/usr/share/cassandra (environment settings)
/usr/share/cassandra/lib (JAR files)
/usr/bin (binary files)
/usr/sbin
/etc/cassandra (configuration files)
/etc/init.d (service startup script)
/etc/security/limits.d (cassandra user limits)
/etc/default

Installing JNA (Java Native Access) on Linux platforms can improve Cassandra memory usage. Install JNA, and add it to /usr/share/cassandra/lib directory.

Here the packaged installation of Apache Cassandra has been done.

Installing the Cassandra Binary Tarball Distribution

DataStax provides binary tarball distributions of Cassandra for installing on platforms that do not have package support, such as Mac, or if you do not have or want to do a root installation. For a complete list of supported platforms, see DataStax Community – Supported Platforms.

Prerequisites

Before installing Cassandra make sure the following prerequisites are met:

Steps to Install Cassandra

java -version

DataStax recommends using the most recently released version of Oracle Java SE Runtime Environment (JRE) 6 on all DSE nodes. Versions earlier than 1.6.0_19 should not be used. Java 7 is not recommended. If you need help installing Java, see Installing Oracle JRE.

$ curl -OL http://downloads.datastax.com/community/dsc-cassandra-1.0.9-bin.tar.gz

$ tar -xvzf dsc-cassandra-1.0.9-bin.tar.gz
$ rm *.tar.gz

If you do not have root access to the default directories, ensure you have write access as follows:

$ sudo mkdir /var/lib/cassandra
$ sudo mkdir /var/log/cassandra
$ sudo chown -R $USER:$GROUP /var/lib/cassandra
$ sudo chown -R $USER:$GROUP /var/log/cassandra

Next Steps

Exit mobile version