When we need data management that requires scalability and high availability without compromising the performance or performance of the system we are building, then Apache Cassandra can be the right choice. Cassandra’s ability to store very large data is unquestionable, this has been proven by the many leading companies that use it. In this short tutorial we will learn how to install Apache Cassandra 4.0 on Ubuntu 20.04 LTS operating system.
Introduction
Apache Cassandra is open-source high-performance NoSQL database management system designed to handle large amounts of data across many commodity servers, providing fault tolerance, linear scalability, and consistency across multiple nodes. Each Cassandra node in the cluster will have a similar job. Data is circulated over the bunch which implies every node holds various information. On this article, we will show you how to install Apache Cassandra on Linux Ubuntu 20.04 LTS operating system.
Cassandra has been used by many companies on handle their daily operation, such as : Netflix, Facebook, Cisco, Hulu, Twitter. Cassandra was developed at Facebook to power the Facebook inbox search feature, and then Facebook released Cassandra as an open-source project on Google code in July 2008.
This tutorial will be divided into several section, namely :
- Prerequisite
- Update Ubuntu Local Repository
- Adding Apache Cassandra Repository
- Installing Apache Cassandra
- Verify Cassandra Installation
Prerequisite
Before installing Apache Cassandra on Ubuntu 20.04 LTS, we have to prepare the environment first. The Apache Cassandra installation requires :
To check Java, whether it is installed on the system or not. For this purpose, we can use the command line:
$ java --version
The output will be as shown below :
ramans@otodiginet:~$ java --version openjdk 11.0.10 2021-01-19 OpenJDK Runtime Environment (build 11.0.10+9-Ubuntu-0ubuntu1.20.04) OpenJDK 64-Bit Server VM (build 11.0.10+9-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)
1. Update Ubuntu System Repository
To update local repository, we will execute command line :
$ sudo apt update
The output will be shown below :
ramans@otodiginet:~$ sudo apt update Hit:1 http://mirror.telkomuniversity.ac.id/ubuntu focal InRelease Hit:2 http://mirror.telkomuniversity.ac.id/ubuntu focal-updates InRelease Hit:3 http://mirror.telkomuniversity.ac.id/ubuntu focal-backports InRelease Hit:4 http://mirror.telkomuniversity.ac.id/ubuntu focal-security InRelease Hit:5 http://ppa.launchpad.net/teejee2008/ppa/ubuntu focal InRelease Get:6 https://dl.bintray.com/apache/cassandra 311x InRelease [3,903 B] Fetched 3,903 B in 4s (1,066 B/s) Reading package lists... Done Building dependency tree Reading state information... Done 57 packages can be upgraded. Run 'apt list --upgradable' to see them. ramans@bckinfo:~$ echo "deb http://downloads.apache.org/cassandra/debian 40x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list deb http://downloads.apache.org/cassandra/debian 40x main
2. Adding Apache Cassandra Repository
On this stage, we will add Apache Cassandra repository to the system. We will do the following command line :
$ curl https://downloads.apache.org/cassandra/KEYS | sudo apt-key add -
The output will be as shown below :
ramans@otodiginet:~$ curl https://downloads.apache.org/cassandra/KEYS | sudo apt-key add - % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 255k 100 255k 0 0 138k 0 0:00:01 0:00:01 --:--:-- 138k OK
3. Installing Apache Cassandra on Ubuntu 20.04 LTS
After Cassandra repository was added to the system, the we will do the installation by submitting command line :
$ sudo apt-get install cassandra
The output will be shown below :
ramans@otodiginet:~$ sudo apt-get install cassandra Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libfprint-2-tod1 libllvm9 Use 'sudo apt autoremove' to remove them. Suggested packages: cassandra-tools The following NEW packages will be installed: cassandra 0 upgraded, 1 newly installed, 0 to remove and 57 not upgraded. Need to get 43.6 MB of archives. After this operation, 54.4 MB of additional disk space will be used. Get:1 https://dl.bintray.com/apache/cassandra 40x/main amd64 cassandra all 4.0~beta4 [43.6 MB] Fetched 43.6 MB in 1min 10s (619 kB/s) Selecting previously unselected package cassandra. (Reading database ... 194645 files and directories currently installed.) Preparing to unpack .../cassandra_4.0~beta4_all.deb ... Unpacking cassandra (4.0~beta4) ... Setting up cassandra (4.0~beta4) ... vm.max_map_count = 1048575 net.ipv4.tcp_keepalive_time = 300 update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults Processing triggers for systemd (245.4-4ubuntu3.4) ...
4. Verify Cassandra Installation
After installation was competed done, then we will verify if Apache Cassandra was installed on the system. For this purpose, we will use a command line :
$ nodetool status
The output will be :
ramans@otodiginet:~$ nodetool status Datacenter: datacenter1 ======================= Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Tokens Owns (effective) Host ID Rack UN 127.0.0.1 68.88 KiB 16 ? 26bd4613-8f91-42fc-a8c0-716465b4a34c rack1 Documented shell commands: =========================== CAPTURE CLS COPY DESCRIBE EXPAND LOGIN SERIAL SOURCE UNICODE CLEAR CONSISTENCY DESC EXIT HELP PAGING SHOW TRACING CQL help topics: ================ AGGREGATES CREATE_KEYSPACE DROP_TRIGGER TEXT ALTER_KEYSPACE CREATE_MATERIALIZED_VIEW DROP_TYPE TIME ALTER_MATERIALIZED_VIEW CREATE_ROLE DROP_USER TIMESTAMP ALTER_TABLE CREATE_TABLE FUNCTIONS TRUNCATE ALTER_TYPE CREATE_TRIGGER GRANT TYPES ALTER_USER CREATE_TYPE INSERT UPDATE APPLY CREATE_USER INSERT_JSON USE ASCII DATE INT UUID BATCH DELETE JSON BEGIN DROP_AGGREGATE KEYWORDS BLOB DROP_COLUMNFAMILY LIST_PERMISSIONS BOOLEAN DROP_FUNCTION LIST_ROLES COUNTER DROP_INDEX LIST_USERS CREATE_AGGREGATE DROP_KEYSPACE PERMISSIONS CREATE_COLUMNFAMILY DROP_MATERIALIZED_VIEW REVOKE CREATE_FUNCTION DROP_ROLE SELECT CREATE_INDEX DROP_TABLE SELECT_JSON
Conclusion
In this short tutorial, we have learned how to install Apache Cassandra vesrion 4.0 on an Ubuntu 20.04 LTS successfully. I hope this tutorial can be useful for anyone who needs it.