Install Apache Cassandra on Ubuntu

28/12/2020

In this quick post, we will see how we can install one of the most popular distributed Databases, Apache Cassandra on Ubuntu and start using it as well. We will get started now.

Read posts about Neo4J, Elasticsearch and MongoDB as well.

Apache Cassandra

Cassandra is one of the most popular distributed NoSQL databases from Apache which is known for its scalability, performance and its high availability with no single point of failure.

Some points which make Apache Cassandra stand tall are:

  • Consistent and highly fault-tolerant.
  • Very close in architecture to Amazon’s Dynamo DB and data model is close to Google’s Bigtable.
  • Created at facebook
  • It is a column-oriented database
  • Used at some very big companis like Cisco, Rackspace, Netflix and many more

Installing Java

To install Cassandra on Ubuntu, we must install Java first. Java might not be installed by default. We can verify it by using this command:

java -version

When we run this command, we get the following output:

We will now install Java on our system. Use this command to do so:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

Once these commands are done running, we can again verify that Java is now installed by using the same command.

Installing Cassandra

Installing Cassandra on Ubuntu is a very easy task and is just a matter of few commands. We will start by adding Cassandra repository to the Ubuntu Source list:

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

Once we run this program, we will get the following output:

Now, we will add the Apache Cassandra repository keys:

curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add

Once we run this program, we will get the following output:

Now, we can update the apt-get list for Ubuntu using this command:

sudo apt-get update

Finally, we’re ready to install Cassandra on Ubuntu machine:

sudo apt-get install cassandra

Last command can take a few minutes based on the Internet speed. We can now check if Cassandra is up and running on our machine:

sudo service cassandra status

We will see that the service is Active:

Connecting to Cassandra cluster

Cassandra is started automatically once the installation process is complete. Cassandra is a distributed database and so, it doesn’t work as a single system but instead, it works in a cluster which can consist of virtually any number of nodes.

When Cassandra starts on our machine, it set up a cluster automatically with a single node as part of it. We can check if the cluster is up using this command:

sudo nodetool status

If we see UN in our output, this means that Cluster is Up and Running:

Connecting to Cassandra Database

In a final step, we will show how we can enter into the Cassandra terminal. Use a simple command to start using Cassandra:

cqlsh

Once you run this, we will see that we can now execute Cassandra commands on our machine and create related data:

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Refind Boot Manager

Most Linux systems boot using GRUB, however alternatives are always worth exploring. When the BURG project was started,...
29/12/2020

Các ứng dụng sử dụng proxy như thế nào để bảo vệ địa chỉ IP của bạn.

Trong thế giới của công nghệ thông tin hiện đại, Proxy đã trở thành một công cụ không thể thiếu...
27/02/2023

XZ Compression Tutorial

Many built-in command-line compression tools are available in Linux operating system. XZ is one of the popular data compression...
29/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Dịch Vụ Xây Dựng Hệ Thống Peering Với Internet Exchange (IXP)
04/04/2025

Dịch Vụ Triển Khai VPN Site-to-Site & Remote Access
04/04/2025

Dịch Vụ Thiết Lập Hệ Thống Tường Lửa (Firewall)
04/04/2025

Dịch Vụ Triển Khai Hệ Thống Ảo Hóa & Cloud
04/04/2025

Dịch Vụ Triển Khai Hệ Thống Ceph
04/04/2025