Install Cassandra on Amazon EC2 (Centos)

cassandra_logo

Simple steps to install cassandra on amazon ec2 (centos) or any rhel based systems

Prerequisites

  • JAVA development kit (open-jdk) : It is already installed on all the EC2 intances.
  • Python : Already installed on EC2 install by default if  not then just fire command $ sudo yum install python python-devel.
  • Setup environment variable :  Configure  $JAVA_HOME and $PATH.
  • Java Native Access (JNA) : It is required for production installations (latest version recommended), You can install it by $ sudo yum install jna.
  • Add Security group rules : Open port 9160, If deploying multi-node cluster then also open ports 6042, 7199, 7000 as well.

Note : JAVA version should be same on all the node if your doing a multi-node installation. Recommended version for latest installation is 8 and 7

Step 1 :  Add the DataStax Community repository to the /etc/yum.repos.d/datastax.repo:

Create a file $ sudo nano /etc/yum.repos.d/datastax.repo

Copy paste following content into it and save it :

[datastax] 
name = DataStax Repo for Apache Cassandra
baseurl = http://rpm.datastax.com/community
enabled = 1
gpgcheck = 0
Step 2 : Install the packages
$ sudo yum install dsc20-2.0.11-1 cassandra20-2.0.11-1
Step 3 :  Start Cassandra
$ sudo service cassandra start
Step 4 :  Open CQLSH utility to start executing Cassandra Query Language (CQL) commands
$ cqlsh

if this command doesn’t work try $ cqlsh localhost 9160




Step 5 : Create a keyspace
cqlsh> CREATE KEYSPACE Excelsior
  WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 3 };

Step 6 : Viewing keyspaces
cqlsh> DESCRIBE keyspaces;

 

That’s it you’ve installed, configured and started cassandra server.

I’ll be making separate post for cassandra multi-node installation.

Stay tuned!



Blogger & Assc Cloud Architect

Site Footer