31 C
Jaipur
Friday, October 30, 2020

How to Install Apache Cassandra on Ubuntu 20.04

Must read

Xiaomi Trumps Apple to Become the Third Best Smartphone Maker Globally

The third quarter saw the smartphone market recover after taking massive hits due to the COVID-19 pandemic earlier this year. Samsung again came out...

Call Of Duty Warzone Mobile Might Become A Reality, Confirms Activision

A while back, Activision put out a job listing with its description saying “WZM,” which clearly meant Warzone Mobile. Ever since then, Call of...

SmartThings Find Locates Your Lost or Misplaced Galaxy Devices

Samsung has launched SmartThings Find, a new service in SmartThings app to help locate your misplaced or stolen Galaxy devices. The app uses Bluetooth...

10 Best Apple Mail Alternatives for Mac and iPhone in 2020

Unlike other stock apps like Safari and Notes, Apple Mail for macOS hasn’t got major improvements for a long time. The email app not...

Apache Cassandra is a high-performance opensource NoSQL database engine that provides fault tolerance, linear scalability, and consistency across multiple nodes. Give its distributed architecture, Apache Cassandra handles huge volumes of data with dynamo-style replication. This is where replicas are stored on several nodes in a cluster thus providing high availability and zero points of failure.

Apache Cassandra is ideal in IoT applications where massive data is collected. It also comes in handy in social media analytics, messaging services, and retail applications.

Among the companies that make use of Apache Cassandra include Netflix, Facebook, Cisco, Hulu, Twitter, and many more.

In this article, you will learn how to install and configure Apache Cassandra on Ubuntu 20.04 and Ubuntu 18.04.

Step 1: Installing Java on Ubuntu

Installation of Apache Cassandra begins with checking whether Java is installed. To be more specific, OpenJDK is what is required to work seamlessly with Apache Cassandra. Installing a different version is more likely to give you errors during configuration.

To check whether Java is installed, run the command:

$ java -version

If Java is not yet installed, you will find the output printed as shown on your terminal.

Check Java Installation on Ubuntu

To install OpenJDK, execute the following apt command.

$ sudo apt install openjdk-8-jdk

Once again, confirm that Java is installed by running the command.

$ java -version
Check Java Version in Ubuntu
Check Java Version in Ubuntu

Step 2: Install Apache Cassandra in Ubuntu

With Java installed, we will proceed to install Apache Cassandra. First, install the apt-transport-https package to allow access of repositories via the https protocol.

$ sudo apt install apt-transport-https

Next, Import the GPG key using following wget command as shown.

$ wget -q -O - https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -

Then add Apache Cassandra’s repository to the system’s sources list file as shown.

$ sudo sh -c 'echo "deb http://www.apache.org/dist/cassandra/debian 311x main" > /etc/apt/sources.list.d/cassandra.list'

Before installing Apache Cassandra, you need to update the package list first.

$ sudo apt update

Then install the NoSQL database using the command:

$ sudo apt install cassandra
Install Apache Cassandra in Ubuntu
Install Apache Cassandra in Ubuntu

Usually, Apache Cassandra starts automatically. To confirm its status, run the following command:

$ sudo systemctl status cassandra

The output below confirms that Cassandra is up and running as expected.

Check Apache Cassandra Status
Check Apache Cassandra Status

Additionally, you can verify the stats of your node by running the command.

$ sudo nodetool status
Check Node Tool Status
Check Node Tool Status

To log in to Cassandra on the terminal, invoke the command.

$ cqlsh
Start Cassandra cqlsh Shell
Start Cassandra cqlsh Shell

Step 3: Configuring Apache Cassandra in Ubuntu

Apache Cassandra configuration files are stacked in the /etc/cassandra directory whilst data is stored in /var/lib/cassandra directory. Start-up options can be tweaked in the /etc/default/cassandra file.

Cassandra’s default cluster name is ‘Test Cluster’. To change this to a more meaningful name, log in to Cassandra.

$ cqlsh

To set the Cluster name to your own preference, run the command shown below. In this case, we are setting the cluster name to ‘Tecmint Cluster

UPDATE system.local SET cluster_name="Tecmint Cluster" WHERE KEY = 'local';

Exit the prompt by typing:

EXIT;

Thereafter, head out to the cassandra.yaml file as shown:

$ sudo vim /etc/cassandra/cassandra.yaml

Search for the cluster_name directive and edit the cluster name accordingly as shown below.

Set Cassandra Cluster Name
Set Cassandra Cluster Name

Save and exit the configuration file and restart the Cassandra service. You can log in again to confirm the cluster name as shown.

Confirm Cassandra Cluster Name
Confirm Cassandra Cluster Name

And that concludes the topic on the installation of Apache Cassandra on Ubuntu 20.04 LTS.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

Xiaomi Trumps Apple to Become the Third Best Smartphone Maker Globally

The third quarter saw the smartphone market recover after taking massive hits due to the COVID-19 pandemic earlier this year. Samsung again came out...

Call Of Duty Warzone Mobile Might Become A Reality, Confirms Activision

A while back, Activision put out a job listing with its description saying “WZM,” which clearly meant Warzone Mobile. Ever since then, Call of...

SmartThings Find Locates Your Lost or Misplaced Galaxy Devices

Samsung has launched SmartThings Find, a new service in SmartThings app to help locate your misplaced or stolen Galaxy devices. The app uses Bluetooth...

10 Best Apple Mail Alternatives for Mac and iPhone in 2020

Unlike other stock apps like Safari and Notes, Apple Mail for macOS hasn’t got major improvements for a long time. The email app not...

Indian Army Launches Atmanirbhar Secure Messaging App ‘SAI’ for Soldiers

The Indian Army has decided to bolster its soldiers’ security by building a WhatsApp-like secure messaging app as part of the Atmanirbhar Bharat campaign....