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:
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 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:
| 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:
Once we run this program, we will get the following output:
Now, we can update the apt-get list for Ubuntu using this command:
Finally, we’re ready to install Cassandra on Ubuntu machine:
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:
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:
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:
Once you run this, we will see that we can now execute Cassandra commands on our machine and create related data: