26.8 C
Texas
angeloma
Senior Writer and partner

How to install Apache Cassandra on Ubuntu 20.04?

A functional quality application needs a quality database manager. Especially when the application is designed for web and with multiple execution nodes. In this sense, most of the best available solutions are open source. This gives us an idea of the great quality of programs that exist whose developers release the source code of the application. On the other hand, these database managers can be SQL or NoSQL according to the need of the application. So in this post, you will learn how to install a NoSQL and open source database manager like Apache Cassandra on Ubuntu 20.04

Apache Cassandra is one of those applications that would take many post to cover all its features. In general, it is a NoSQL database manager that is sponsored by the Apache foundation. This way it is easy to assume that it is open source and that it is strongly supported by the community.

Its main utility? is that it allows to make high-performance data clusters worldwide and above all we can make changes without data loss or falls. Then, the segment to which it is directed is a little less broad than other alternatives such as MongoDB.

So, let us start.

Install Apache Cassandra on Ubuntu 20.04

- Advertisement -

Before starting the tutorial, we suggest you update the system.

:~$ sudo apt update
:~$ sudo apt upgrade

In this way, the necessary security patches are installed to increase the stability of the system.

The best way to install Apache Cassandra on your system is to use the official repositories provided by the application developers.

First, install some necessary packages:

:~$ sudo apt install wget curl gnupg gnupg1 gnupg2

Then, download the GPG key from the Cassandra Apache repository.

:~$ wget https://www.apache.org/dist/cassandra/KEYS
--2020-06-26 19:10:09-- https://www.apache.org/dist/cassandra/KEYS
Resolving www.apache.org (www.apache.org)… 95.216.24.32, 40.79.78.1, 2a01:4f9:2a:185f::2
Connecting to www.apache.org (www.apache.org)|95.216.24.32|:443… connected.
HTTP request sent, awaiting response… 302 Found
Location: https://downloads.apache.org/cassandra/KEYS [following]
--2020-06-26 19:10:10-- https://downloads.apache.org/cassandra/KEYS
Resolving downloads.apache.org (downloads.apache.org)… 88.99.95.219, 2a01:4f8:10a:201a::2
Connecting to downloads.apache.org (downloads.apache.org)|88.99.95.219|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 258626 (253K)
Saving to: ‘KEYS’
KEYS 100%[=====================================================================================>] 252.56K 39.2KB/s in 6.5s
2020-06-26 19:10:18 (39.2 KB/s) - ‘KEYS’ saved [258626/258626]

Now add it to the operating system.

:~$ sudo apt-key add KEYS
OK

The next step is to add the Cassandra Apache repository. If you want the latest stable version, then add this repository:

:~$ echo "deb http://www.apache.org/dist/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list

In case you want to use the latest test version, i.e. Cassandra 4

:~$ echo "deb http://www.apache.org/dist/cassandra/debian 40x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list

Remember, you only have to add a repository.

Then, update the APT cache.

:~$ sudo apt update

Finally, install Apache Cassandra by running the following command:

:~$ sudo apt install cassandra
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
ca-certificates-java fontconfig-config fonts-dejavu-core java-common libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libfontconfig1 libjpeg-turbo8
libjpeg8 liblcms2-2 libnspr4 libnss3 libpcsclite1 libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib libxi6 libxrender1 libxtst6 openjdk-8-jre-headless
python-is-python2 python2 python2-minimal python2.7 python2.7-minimal x11-common
Suggested packages:
cassandra-tools default-jre cups-common liblcms2-utils pcscd libnss-mdns fonts-dejavu-extra fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei
fonts-wqy-zenhei fonts-indic python2-doc python-tk python2.7-doc binutils binfmt-support
The following NEW packages will be installed:
ca-certificates-java cassandra fontconfig-config fonts-dejavu-core java-common libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libfontconfig1
libjpeg-turbo8 libjpeg8 liblcms2-2 libnspr4 libnss3 libpcsclite1 libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib libxi6 libxrender1 libxtst6
openjdk-8-jre-headless python-is-python2 python2 python2-minimal python2.7 python2.7-minimal x11-common
0 upgraded, 29 newly installed, 0 to remove and 39 not upgraded.
Need to get 75.6 MB of archives.
After this operation, 180 MB of additional disk space will be used.
Do you want to continue? [Y/n]
1.- Installing Apache Cassandra on Ubuntu 20.04
1.- Installing Apache Cassandra on Ubuntu 20.04

Once the installation is completed, the system will automatically start it as it is a systemd managed service.

Therefore, it is advisable to check the operation of the program with:

:~$ sudo systemctl status cassandra
● cassandra.service - LSB: distributed storage system for structured data
Loaded: loaded (/etc/init.d/cassandra; generated)
Active: active (running) since Fri 2020-06-26 19:43:01 UTC; 14min ago
Docs: man:systemd-sysv-generator(8)
Tasks: 47 (limit: 846)
Memory: 594.0M
CGroup: /system.slice/cassandra.service
└─5232 java -ea -da:net.openhft… -XX:+UseThreadPriorities -XX:+HeapDumpOnOutOfMemoryError -Xss256k -XX:StringTableSize=1000003 -XX:+AlwaysPreTouch -XX:-U>
Jun 26 19:43:01 osradar systemd[1]: Starting LSB: distributed storage system for structured data…
Jun 26 19:43:01 osradar systemd[1]: Started LSB: distributed storage system for structured data.
lines 1-11/11 (END)
2.- Apache Cassandra service status
2.- Apache Cassandra service status

Finally, it will be ready to use.

Preparing Apache Cassandra for the first use

Apache Cassandra is already installed, but it is convenient to make some adjustments before using it completely.

All Apache Cassandra settings are in the file /etc/cassandra/cassandra.yaml

There, you have to change some values like these:

cluster_name : ['cluster_name']

This value specifies the name of the cluster you will form with Apache Cassandra.

Also,you can define the seeds of the cluster, you have to specify the IP addresses in this section:

seeds: ["ip_address", "ip_address"]

Also, it is recommended to change Apache Cassandra’s default port with the directive:

storage_port :[port]

Then, save the changes, close the editor, and finally restart the service to apply the changes:

:~$ sudo systemctl restart cassandra

So, enjoy it.

Conclusion

In this post, you learned how to install Apache Cassandra on Ubuntu 20.04. With this NoSQL database manager, you will be able to cluster data at the level of large networks. All without sacrificing system resources and with high performance without packet loss.

So, share this post, join our Telegram Channel and buy us a coffee.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article