Install Cassandra on Linux CentOS

Download the newest version of Cassandra

I wrote this tutorial using this version:

http://www.apache.org/dyn/closer.cgi?path=/cassandra/2.0.2/apache-cassandra-2.0.2-bin.tar.gz

 Commands:

$ wget http://ftp.unicamp.br/pub/apache/cassandra/2.0.2/apache-cassandra-2.0.2-bin.tar.gz
$ tar -zxvf apache-cassandra-2.0.2-bin.tar.gz
$ sudo cp -r apache-cassandra-2.0.2 /usr/local
$ cd /usr/local/apache-cassandra-2.0.2/config

Open the file:

$ vim cassandra.yaml

Check the folders in environment variables inside the file:

-data_file_directories
-commitlog_directory
-saved_caches_directory

Now, create the respective folders:

$ sudo mkdir -p /var/lib/cassandra/data
$ sudo mkdir -p /var/lib/cassandra/commitlog
$ sudo mkdir -p /var/lib/cassandra/saved_caches
$ sudo mkdir -p /var/log/cassandra

To allow the users, execute the following commands:

Current user:

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

Or a specific user:

$ sudo chown -R userx:user-groupx /var/log/cassandra/
$ sudo chown -R userx:user-groupx /var/lib/cassandra/

In order to configure Cassandra to accept connections from others computers change the file:

/usr/local/apache-cassandra-2.0.2/conf/cassandra.yaml at the variable rpc_address change localhost to 0.0.0.0

Start Cassandra in the Foreground (Testing environment)

$ /usr/local/apache-cassandra-2.0.2/bin/cassandra -f

Start Cassandra in the Background

$ /usr/local/apache-cassandra-2.0.2/bin/cassandra

To kill the process:

$ pkill -f CassandraDaemon
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s