In this article, we will have explained the necessary steps to install and configure Apache Cassandra on Ubuntu 18.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.
Apache Cassandra is a highly scalable database management system that used to manage very large amounts of structured data. It can able to perform on multi-node setups. The Cassandra supports relational databases including MySQL, PostgreSQL and Microsoft SQL and Cassandra is used by a number of organizations including Apple, NetFlix, eBay, and Easou.
Install Apache Cassandra on Ubuntu
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
sudo apt update sudo apt upgrade sudo apt install apt-transport-https
Step 2. Install Java.
Install the Java package by typing:
sudo apt install openjdk-8-jdk
Verify the Java installation by running the following command which will print the Java version:
Step 2. Install Apache Cassandra.
Now, add the Apache Cassandra repository:
sudo sh -c 'echo "deb http://www.apache.org/dist/cassandra/debian 311x main" > /etc/apt/sources.list.d/cassandra.list'
Import the repository’s GPG using the following command:
wget -q -O - https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
Then, we can install Cassandra by running the following command:
sudo apt update sudo apt install cassandra
You can verify that Cassandra is running by typing:
Datacenter: datacenter1 ======================= Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Tokens Owns (effective) Host ID Rack UN 127.0.0.1 156.55 KiB 456 100.0% d8c27e24-e46-4eeb-883c-5986218ba3ca rack1
Step 3. Configuring Apache Cassandra.
Apache Cassandra data is stored in the /var/lib/cassandra directory, configuration files are located in /etc/cassandra and Java start-up options can be configured in the /etc/default/cassandra file.
To interact with Cassandra through CQL (the Cassandra Query Language) you can use a command line utility named cqlsh that is shipped with the Cassandra package:
Connected to Test Cluster at 127.0.0.1:9042. [cqlsh 5.1.1 | Cassandra 3.11.4 | CQL spec 3.4.4 | Native protocol v4] Use HELP for help. cqlsh>