How to Install Cassandra on CentOS 7
Cassandra is a reliable, clusterable, highly-scalable database capable of handling large quantities of data on commodity hardware. If you have big data needs, and are looking for a proven open source solution that has received battle testing from many large companies, then Cassandra may be exactly what you’re looking for. If you have a CentOS 7 server, this guide will get you up and running with a single Cassandra node. It will use pre-packaged Cassandra distributions built for CentOS, making installation and upgrades a snap. You can then build it out by performing additional installations on other servers, then clustering the resulting instances for higher scalability and reliability. This article will guide you on how to install Apache Cassandra on CentOS 7 Server.
Begin by applying all available patches and security updates to your CentOS 7 server.
yum -y update
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
Packages for Cassandra are shipped in a Datastax repository. In order to automatically retrieve these packages, and to fetch upgrades in the future, we’ll create this repository so Yum can use it.
name = DataStax Repo for Apache Cassandra
baseurl = http://rpm.datastax.com/community
enabled = 1
gpgcheck = 0
Now Cassandra is ready to be installed.
yum -y install dsc20
With Cassandra installed, we must now start the daemon via systemd.
The systemd unit is now created. Use “systemctl start cassandra” to launch the new unit.
systemctl enable cassandra.service
While the database should be running, it is not yet configured to launch on boot. Let’s tell systemd that Cassandra should automatically launch whenever your system boots.
[root@cassandra ~] systemctl status cassandra
cassandra.service - SYSV: Starts and stops Cassandra
Loaded: loaded (/etc/rc.d/init.d/cassandra)
Active: active (exited) since Thu 2016-09-15 04:36:47 UTC; 14s ago
Process: 9413 ExecStart=/etc/rc.d/init.d/cassandra start (code=exited, status=0/SUCCESS)
Let’s ensure that Cassandra is running using this command.
[root@cassandra ~] 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.
Cassandra ships with a powerful command line utility, cqlsh. Launch it to perform various vital tasks with your database.
[root@cassandra ~] nodetool status
-- Address Load Tokens Owns (effective) Host ID Rack
UN 127.0.0.1 46.21 KB 256 100.0% 7dd2b7d9-404e-4a77-a36d-cc8f55168c0d rack1
Likewise, the nodetool command shows the status of your Cassandra node.
You now have a fresh Cassandra instance into which you can load large amounts of data. Share this guide with anyone you may know of who is in search of a big data solution, so they too can enjoy the benefits of an easy Cassandra installation. If you found this article helpful, feel free to share it with your friends and let us know in the comments below!