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 through the step-by-step installation of Apache Cassandra on a CentOS 7 server.
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:
Paste below given content in 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:
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.