Install Apache Cassandra on a Debian 7 VPS

Leave reply

CassandraApache Cassandra is an open source distributed database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. Cassandra offers robust support for clusters spanning multiple datacenters, with asynchronous masterless replication allowing low latency operations for all clients.

The Apache Cassandra database is the right choice when you need scalability and high availability without compromising performance.

By following this tutorial, you will learn how to install Cassandra and the Oracle Java JDK on a Debian 7 VPS. We will also cover the steps needed to run your first test single-node cluster.

REQUIREMENTS

We will be using our SSD 1 Linux VPS Hosting plan for this tutorial.

UPDATE THE SYSTEM

Make sure your server is fully up to date using:

# apt-get update
# apt-get upgrade

INSTALL ORACLE JAVA JDK

Open your favorite web browser and navigate to the Oracle Java website to decide which version do you want to download and install. If you are using a 32bit OS version, choose the 32 bit tar.gz file.

To check what version of Debian 7 you are running, just type this in your terminal window:

# arch

For our purposes we will download the 64bit tar.gz archive.

For downloading and extracting the Java JDK into a newly created directory, you will need to use the following commands:

# wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz
# mkdir /opt/jdk
# tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk

Set the default JVM in your server:

# update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_05/bin/java 100
# update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_05/bin/javac 100

Verify that Java has been installed successfully by running:

# java -version

INSTALL APACHE CASSANDRA

We will download the latest version of Cassandra into the opt directory. Run:

# cd /opt

# wget http://www.us.apache.org/dist/cassandra/2.1.3/apache-cassandra-2.1.3-bin.tar.gz

Unpack the archive:

# tar -xvzf apache-cassandra-2.1.3-bin.tar.gz

Now move the installation in the root directory:

# mv apache-cassandra-2.1.3 ~/cassandra

Create the needed directories:

# mkdir /var/lib/cassandra

# mkdir /var/log/cassandra

Set Cassandra’s variables by running:

# export CASSANDRA_HOME=~/cassandra

# export PATH=$PATH:$CASSANDRA_HOME/bin

You will need to configure Cassandra’s per-thread stack size to a larger one than the current value. You can do that by editing the cassandra-env.sh file with your favorite text editor. We are using vim.

# vim ~/cassandra/conf/cassandra-env.sh

Find the line that says:

JVM_OPTS="$JVM_OPTS -Xss256k"

and change it to:

JVM_OPTS="$JVM_OPTS -Xss512k"

You can run a single-node test cluster of Cassandra with the following commands:

# sh ~/cassandra/bin/cassandra

# sh ~/cassandra/bin/cassandra-cli

If you get “Connected to: ‘Test Cluster” you are running your single-node cluster successfully.

Congratulations. You have successfully installed Apache Cassandra and the needed Oracle Java JDK on your Debian 7 VPS.

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install Apache Cassandra for you.They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.


50% OFF Coupon

EXCLUSIVE EMAIL UPDATES AND “MEMBERS-ONLY” CONTENT


Leave a Reply