Atlantic.Net Blog

How to Install Apache Cassandra on Oracle Linux 8

Hitesh Jethva
by Atlantic.Net (414 posts) under Tutorials, VPS Hosting
0 Comments

Apache Cassandra is an open-source, wide-column store NoSQL database management system designed to handle large amounts of data. Cassandra can be distributed across many servers to achieve high availability with no single point of failure. Generally, it is used to serve as a real-time operational data store for online transactional applications and as a read-intensive database for large-scale systems. Currently, it is used by many organizations including Netflix, Digg, Adobe, Twitter, HP, IBM, Rackspace, Cisco, and Reddit.

In this guide, we will explain how to install Apache Cassandra on Oracle Linux 8.

Prerequisites

  • A server running Oracle Linux 8 on the Atlantic.Net Cloud Platform
  • A root password configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Oracle Linux as the operating system with at least 4GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your server, run the following command to update your base system with the latest available packages.

dnf update -y

Step 2 – Install Java 8

By default, Apache Cassandra supports only Java version 8, so Java 8 must be installed on your server. If it is not installed, you can install it with other dependencies using the following command:

dnf install epel-release python2 python2-pip java-1.8.0-openjdk -y

After installation, verify the Java installation with the following command:

java -version

You will get the Java version in the following output:

openjdk version "1.8.0_332"
OpenJDK Runtime Environment (build 1.8.0_332-b09)
OpenJDK 64-Bit Server VM (build 25.332-b09, mixed mode)

Next, install the cqlsh command-line utility to connect to Cassandra via command-line.

pip2 install cqlsh

Step 3 – Install Apache Cassandra

By default, the Apache Cassandra package is not included in the Oracle Linux 8 default repository, so you will need to create a repo for Apache Cassandra. You can create an Apache Cassandra repo using the following command:

nano /etc/yum.repos.d/cassandra.repo

Add the following lines:

[cassandra]
name=Apache Cassandra
baseurl=https://www.apache.org/dist/cassandra/redhat/40x/
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.apache.org/dist/cassandra/KEYS

Save and close the file when you are done, then install Apache Cassandra with the following command:

dnf install cassandra -y

Step 4 – Create a Service File for Cassandra

It is recommended to create a service file to manage the Apache Cassandra service via systemd. You can create it with the following command:

nano /etc/systemd/system/cassandra.service

Add the following lines:

[Unit]
Description=Apache Cassandra
After=network.target

[Service]
PIDFile=/var/run/cassandra/cassandra.pid
User=cassandra
Group=cassandra
ExecStart=/usr/sbin/cassandra -f -p /var/run/cassandra/cassandra.pid
Restart=always

[Install]
WantedBy=multi-user.target

Save and close the file, then reload the systemd daemon to apply the changes:

systemctl daemon-reload

Next, start and enable the Cassandra service with the following command:

systemctl start cassandra
systemctl enable cassandra

To verify the status of Apache Cassandra, run the following command:

systemctl status cassandra

You should see the following output:

● cassandra.service - Apache Cassandra
   Loaded: loaded (/etc/systemd/system/cassandra.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-04-30 07:54:46 EDT; 15s ago
 Main PID: 2170 (java)
    Tasks: 23 (limit: 23694)
   Memory: 1.1G
   CGroup: /system.slice/cassandra.service
           └─2170 /usr/bin/java -ea -da:net.openhft... -XX:+UseThreadPriorities -XX:+HeapDumpOnOutOfMemoryError -Xss256k -XX:+AlwaysPreTouch >

Apr 30 07:55:00 oraclelinux cassandra[2170]: INFO  [main] 2022-04-30 07:55:00,318 CassandraDaemon.java:640 - Classpath: /etc/cassandra/conf:/>
Apr 30 07:55:00 oraclelinux cassandra[2170]: INFO  [main] 2022-04-30 07:55:00,319 CassandraDaemon.java:642 - JVM Arguments: [-ea, -da:net.ope>
Apr 30 07:55:00 oraclelinux cassandra[2170]: WARN  [main] 2022-04-30 07:55:00,405 NativeLibrary.java:201 - Unable to lock JVM memory (ENOMEM)>
Apr 30 07:55:00 oraclelinux cassandra[2170]: INFO  [main] 2022-04-30 07:55:00,569 MonotonicClock.java:202 - Scheduling approximate time conve>
Apr 30 07:55:00 oraclelinux cassandra[2170]: INFO  [main] 2022-04-30 07:55:00,577 MonotonicClock.java:338 - Scheduling approximate time-check>
Apr 30 07:55:00 oraclelinux cassandra[2170]: WARN  [main] 2022-04-30 07:55:00,585 StartupChecks.java:143 - jemalloc shared library could not >
Apr 30 07:55:00 oraclelinux cassandra[2170]: WARN  [main] 2022-04-30 07:55:00,585 StartupChecks.java:187 - JMX is not enabled to receive remo>
Apr 30 07:55:00 oraclelinux cassandra[2170]: INFO  [main] 2022-04-30 07:55:00,590 SigarLibrary.java:44 - Initializing SIGAR library
Apr 30 07:55:00 oraclelinux cassandra[2170]: WARN  [main] 2022-04-30 07:55:00,603 SigarLibrary.java:174 - Cassandra server running in degrade>
Apr 30 07:55:00 oraclelinux cassandra[2170]: WARN  [main] 2022-04-30 07:55:00,604 StartupChecks.java:329 - Maximum number of memory map areas>

Step 5 – Verify Apache Cassandra

Wait for some time to bring up Apache Cassandra completely, then verify Apache Cassandra using the following command:

nodetool status

You will get the following error:

nodetool: Failed to connect to '127.0.0.1:7199' - URISyntaxException: 'Malformed IPv6 address at index 7: rmi://[127.0.0.1]:7199'.

To resolve this error, add the “legacy” parsing flag when running nodetool:

nodetool -Dcom.sun.jndi.rmiURLParsing=legacy status

You should get the following output:

Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens  Owns (effective)  Host ID                               Rack 
UN  127.0.0.1  69.06 KiB  16      100.0%            91f2092e-f428-40f8-8093-efe820abe917  rack1

Next, connect to the Cassandra shell using the cqlsh utility:

cqlsh

Once you are connected, you should get the following output:

Connected to Test Cluster at 127.0.0.1:9042
[cqlsh 6.0.0 | Cassandra 4.0.3 | CQL spec 3.4.5 | Native protocol v5]
Use HELP for help.
cqlsh> 

Step 6 – Change Cassandra Cluster Name

By default, Cassandra’s cluster name is set as  “Test Cluster.” To change the default cluster name, connect to Cassandra with the following command:

cqlsh

Next, change the cluster name with the following command:

cqlsh> UPDATE system.local SET cluster_name = 'Atlantic Cluster' WHERE KEY = 'local';

Next, exit from the Cassandra shell with the following command:

cqlsh> exit

Next, edit the Apache Cassandra main configuration file and define your new cluster name:

nano /etc/cassandra/default.conf/cassandra.yaml

Change the Cassandra cluster name as shown below:

cluster_name: 'Atlantic Cluster'

Save and close the file, then restart Apache Cassandra to apply the changes:

systemctl restart cassandra

Now, verify the Cassandra cluster name with the following command:

cqlsh

You should get your new cluster name in the following output:

Connected to Atlantic Cluster at 127.0.0.1:9042
[cqlsh 6.0.0 | Cassandra 4.0.3 | CQL spec 3.4.5 | Native protocol v5]
Use HELP for help.

Conclusion

In the above guide, we explained how to install Apache Cassandra on Oracle Linux 8. You can now use Apache Cassandra to handle and manage large data sets. Give it a try on VPS hosting from Atlantic.Net!

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

Top 10 Best Cybersecurity Training Services
How to Install Ansible on Oracle Linux 8
How to Install LEMP Server on Oracle Linux 8
How to Install and Configure Apache Webserver on Oracle Linux 8
How to Install and Configure Nginx Webserver on Oracle Linux 8

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2008 Lookout Dr,

Dallas, Texas 75044

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources