YouTube Icon

Code Playground.

How to Install Apache Cassandra on Ubuntu 18.04


How to Install Apache Cassandra on Ubuntu 18.04

Apache Cassandra is a free and open-source NoSQL information base with no single purpose of disappointment. It gives direct versatility and high accessibility without bargaining execution. Apache Cassandra is utilized by various associations including Apple, NetFlix, eBay, and Easou. 

In this instructional exercise, we will tell you the best way to introduce Apache Cassandra on Ubuntu 18.04. Similar directions apply for Ubuntu 16.04 and any Ubuntu-based dispersion, including Linux Mint, Kubuntu and Elementary OS. 


To have the option to introduce bundles on your Ubuntu framework, you should be signed in as a client with sudo advantages . 

Installing Apache Cassandra

The simplest method to introduce Apache Cassandra on Ubuntu 18.04 is by introducing the deb bundle from the official Apache Cassandra store. 

At the hour of composing this article, the most recent form of Apache Cassandra is 3.11 and requires OpenJDK 8 to be introduced on the framework. 

Java establishment is pretty basic, start by refreshing the bundle record: 

sudo apt update

Introduce the OpenJDK bundle by composing: 

sudo apt install openjdk-8-jdk

Confirm the Java establishment by running the accompanying order which will print the Java adaptation : 

java -version

The yield should look something like this: 

openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

Introduce the able vehicle https bundle that is important to get to a vault over HTTPS: 

sudo apt install apt-transport-https

The following stage is to add the Apache Cassandra storehouse. 

Import the storehouse's GPG utilizing the accompanying wget order: 

wget -q -O - | sudo apt-key add -

The order above should yield OK which implies that the key has been effectively imported and bundles from this vault will be viewed as trusted. 

Next, add the Cassandra storehouse to the framework by giving: 

sudo sh -c 'echo "deb 311x main" > /etc/apt/sources.list.d/cassandra.list'

When the storehouse is empowered, update the able bundle list and introduce the most recent rendition of Apache Cassandra by composing: 

sudo apt update
sudo apt install cassandra

Cassandra administration will consequently begin after the establishment cycle is finished. You can check that Cassandra is running by composing: 

nodetool status

You should see something like this: 

Datacenter: datacenter1
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load        Tokens       Owns (effective)  Host ID                               Rack
UN  114.55 KiB  256          100.0%            d8c27e24-ea26-4eeb-883c-5986218ba3ca  rack1

Congrats, now you have Apache Cassandra introduced on your Ubuntu worker. 

Configuring Apache Cassandra 

Apache Cassandra information is put away in the/var/lib/cassandra registry, setup documents are situated in/and so on/cassandra and Java fire up choices can be designed in the/and so on/default/cassandra record. 

As a matter of course, Cassandra is designed to tune in on localhost as it were. In the event that the customer interfacing with the information base is additionally running on a similar host you don't have to change the default setup document. 

To interface with Cassandra through CQL (the Cassandra Query Language) you can utilize an order line utility named cqlsh that is dispatched with the Cassandra bundle. 

Connected to Test Cluster at
[cqlsh 5.0.1 | Cassandra 3.11.4 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.

Renaming Apache Cassandra Cluster

Naturally, the Cassandra group is named "Test Cluster". On the off chance that you need to change the name, follow the means underneath: 

Login to the Cassandra CQL terminal with cqlsh: 


Run the accompanying order to change the group name to "Linuxize Cluster": 

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

Change "Linuxize Cluster" with your ideal name. When done sort exit to leave the comfort. 

Alter the cassandra.yaml arrangement record and enter your new group name. 


cluster_name: 'Linuxize Cluster'

Run the accompanying order to clear the framework reserve: 

nodetool flush system

At long last restart the Cassandra administration: 

sudo systemctl restart cassandra


You have effectively introduced Apache Cassandra on your Ubuntu 18.04. You would now be able to visit the official Apache Cassandra Documentation page and figure out how to begin with Cassandra. 

On the off chance that you hit an issue or have criticism, leave a remark underneath.