In this tutorial, we will show you how to install and configuration of Cassandra on your CentOS 7. For those of you who didn’t know, Apache Cassandra is a NoSQL database intended for storing large amounts of data in a decentralized, highly available cluster. NoSQL refers to a database with a data model other than the tabular relations used in relational databases such as MySQL, PostgreSQL, and Microsoft SQL. The Apache Cassandra database is the right choice when you need scalability and high availability without compromising performance.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of Apache Cassandra on a CentOS 7 server.
Prerequisites
- A server running one of the following operating systems: CentOS 7.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Cassandra on CentOS 7
Step 1. First, let’s start by ensuring your system is up-to-date.
yum clean all yum -y update
Step 2. Installing Java for Cassandra.
Cassandra is written in Java. As such, you’ll need the Java VM installed in order to run it. Do so via Yum:
yum -y install java
Verify Installed Java version:
# java -version java version "1.8.0_40" Java(TM) SE Runtime Environment (build 1.8.0_40-b25) Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)
Step 3. Create yum
repo file for Cassandra.
Create a yum repo file that will get the packages from Datastax yum repository server:
nano /etc/yum.repos.d/datastax.repo
Paste below the given content in the repo file:
[datastax] name = DataStax Repo for Apache Cassandra baseurl = http://rpm.datastax.com/community enabled = 1 gpgcheck = 0
Save and exit
Step 4. Installing Cassandra.
At this point, installing Cassandra is as simple as running just one command:
yum -y install dsc20
Get Cassandra Running:
systemctl start cassandra systemctl status cassandra systemctl enable cassandra
Let’s ensure that Cassandra is running using this command:
### cqlsh Connected to Test Cluster at localhost:9160. [cqlsh 4.1.1 | Cassandra 2.0.17 | CQL spec 3.1.1 | Thrift protocol 19.39.0] Use HELP for help. cqlsh>
Cassandra ships with a powerful command-line utility, cqlsh
. Launch it to perform various vital tasks with your database:
nodetool status
Congratulations! You have successfully installed Apache Cassandra. Thanks for using this tutorial for installing Cassandra on your CentOS 7 system. For additional help or useful information, we recommend you to check the official Apache Cassandra website.