YouTube Icon

Code Playground.

How to Install Apache Cassandra on Ubuntu 20.04

CFG

How to Install Apache Cassandra on Ubuntu 20.04

Apache Cassandra is a free and open-source NoSQL information base with no single purpose of disappointment. It gives straight adaptability and high accessibility without bargaining execution. Apache Cassandra is utilized by numerous organizations that have enormous, dynamic informational indexes, including Reddit, NetFlix, Instagram, and Github. 

This article guides you through the establishment of Apache Cassandra on Ubuntu 20.04. 

Introducing the Apache Cassandra on Ubuntu is clear. We'll introduce Java, empower the Apache Cassandra store, import the vault GPG key, and introduce the Apache Cassandra worker. 

Installing Java

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. 

Run the accompanying order as root or client with sudo benefits to introduce OpenJDK : 

sudo apt update
sudo apt install openjdk-8-jdk

Check the Java establishment by printing the Java form : 

java -version

The yield should look something like this: 

Output

openjdk version "1.8.0_265"
OpenJDK Runtime Environment (build 1.8.0_265-8u265-b01-0ubuntu2~20.04-b01)
OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)

Installing Apache Cassandra

Introduce the conditions important to include another store over HTTPS: 

sudo apt install apt-transport-https

Import the store's GPG key and add the Cassandra vault to the framework: 

wget -q -O - https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
sudo sh -c 'echo "deb http://www.apache.org/dist/cassandra/debian 311x main" > /etc/apt/sources.list.d/cassandra.list'

When the store is empowered, update the bundles list and introduce the most recent variant of Apache Cassandra: 

sudo apt update
sudo apt install cassandra

Apache Cassandra administration will naturally begin after the establishment cycle is finished. You can confirm it by composing: 

nodetool status

You should see something like this: 

Output
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load    Tokens  Owns (effective)  Host ID                               Rack
UN  127.0.0.1  70 KiB  256     100.0%            2eaab399-be32-49c8-80d1-780dcbab694f  rack1

That is it. Now, you have Apache Cassandra introduced on your Ubuntu worker. 

Configuring Apache Cassandra

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

Naturally, Cassandra is designed to tune in on localhost as it were. In the event that the customer associating with the information base is additionally running on a similar host, you don't have to change the default setup record. 

To cooperate with Cassandra through CQL (the Cassandra Query Language) you can utilize an order line apparatus named cqlsh that is delivered with the Cassandra bundle. 

cqlsh
Output

Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.11.7 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh>

Renaming Apache Cassandra Cluster

The default Cassandra group is named "Test Cluster". On the off chance that you need to change the group name, play out the means beneath: 

Login to the Cassandra CQL terminal with cqlsh: 

cqlsh

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

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

When done, type exit to leave the comfort. 

Open the cassandra.yaml design document and enter your new group name. 

/etc/cassandra/cassandra.yaml
cluster_name: 'Linuxize Cluster'

Spare and close the document. 

Clear the framework reserve: 

nodetool flush system

Restart the Cassandra administration: 

sudo systemctl restart cassandra

Conclusion

We've told you the best way to introduce Apache Cassandra on Ubuntu 20.04. You would now be able to visit the official Apache Cassandra Documentation page and figure out how to begin with Cassandra. 

In the event that you hit an issue or have criticism, leave a remark beneath.




CFG