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

10 Best Email Clients for Ubuntu

Earlier Ubuntu users had limited choices in terms of applications available for Ubuntu. But with its rapidly increasing...
28/12/2020

[MongoDB] Hướng dẫn cài đặt MongoDB trên CentOS 7

MongoDB là 1 cơ sở dữ liệu đa nền tảng, được sử dụng để lưu trữ dữ liệu khối lượng lớn....
30/12/2020

Thuê mua proxy Pixel giá tốt, tốc độ CỰC ĐỈNH

Dịch vụ thuê mua proxy Pixel giá tốt đang được rất nhiều người kiếm tiền online từ game Pixel quan...
10/05/2024
Bài Viết

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

Tìm Hiểu Về Thuê Proxy US – Lợi Ích và Cách Sử Dụng Hiệu Quả
11/12/2024

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024

Mua proxy Onet uy tín tại Onet.com.vn
03/06/2024

Thuê mua IPv4 giá rẻ, tốc độ nhanh, uy tín #1
28/05/2024