In this blog, we will explain how to Install Cassandra v3 on CentOS 6. Apache Cassandra is a NoSQL database intended for storing large amounts of data in a decentralized, highly available cluster.
Pre-requisite to install Cassandra on CentOS or Linux
Check Java version if it is already installed:
[root@Sks-cluster-linux ~]# java -version java version "1.8.0_151" Java(TM) SE Runtime Environment (build 1.8.0_151-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode) [root@Sks-cluster-linux ~]#
Install Java 8 on Linux
$ sudo yum install java-1.8.0-openjdk
Create Cassandra.repo file
– so that you can install from the yum command:
[root@Sks-cluster-linux ~]# cat /etc/yum.repos.d/cassandra.repo [cassandra] name=Apache Cassandra baseurl=https://www.apache.org/dist/cassandra/redhat/311x/ gpgcheck=0 enabled = 1 repo_gpgcheck=0 gpgkey=https://www.apache.org/dist/Cassandra/KEYS [root@Sks-cluster-linux ~]#
Install Cassandra on Linux:
[root@Sks-cluster-linux ~]# sudo yum install Cassandra
Command to start Cassandra service on Linux:
[root@Sks-cluster-linux ~]# service cassandra start
Make Cassandra to start automatically after reboot:
[root@Sks-cluster-linux ~]# chkconfig cassandra on
Command to restart Cassandra service on Linux
service cassandra restart
Command to shutdown Cassandra service on Linux
service cassandra stop
/etc/cassandra/conf/cassandra-env.sh /var/log/cassandra/cassandra.log /var/log/cassandra/debug.log /var/log/cassandra/gc.log.0.current /var/log/cassandra/system.log
Cassandra commands for service start|stop|status:
service cassandra start service cassandra stop service cassandra status
Cassandra known Issue:
ERROR: [root@sks-cluster-linux~]# service cassandra status cassandra dead but pid file exists
(OR)
ERROR: CassandraDaemon.java:706 - Local host name unknown: java.net.UnknownHostException
Cassandra Solutions 1:
//This error may be because of heap-memory of system – check your system memory (free -m/2 after divide it should be greater than 2GB)
//So upgrade your box to min 6GB
Cassandra Solution 2:
In AWS EC2, when you install Cassandra you can have this problem because of the initially configured hostname which is set to ip-x-x-x-x being x-x-x-x the EC2 instance private address. The steps to solve it:
Edit network configuration file /etc/sysconfig/network
HOSTNAME=[myservername]
Edit hosts file:
sudo vi /etc/hosts
Add hostname entry to /etc/hosts
127.0.0.1 [myservername]
Set hostname or reboot
sudo hostname [myservername]
These are the steps how to Install Cassandra v3 on CentOS 6.
thanks for reading the articles, you will also like:
Steps to Manage logs in Linux using Logrotate
How to install Redis on Amazon Linux or CentOS
Steps to Install Tomcat on Linux
How to execute script or command on reboot or startup in Linux