Cassandra Installation
Cassandra is a popular open-source distributed NoSQL database management system that is designed to handle large amounts of data across many commodity servers with no single point of failure. In this tutorial, we will walk through the installation process for Cassandra on different operating systems.
Syntax
Cassandra can be installed on different platforms through different installation methods. Here is a brief syntax of the installation commands for different platforms:
Debian/Ubuntu
# Add the Cassandra repository
echo "deb http://www.apache.org/dist/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
# Add the repository keys
curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
# Update the package index and install Cassandra
sudo apt update
sudo apt install cassandra
CentOS/RHEL
# Add the Cassandra repository
sudo vi /etc/yum.repos.d/datastax.repo
# Add the following lines into the file
[datastax]
name = DataStax Repo for Apache Cassandra
baseurl = https://rpm.datastax.com/community
enabled = 1
gpgcheck = 0
# Install Cassandra
sudo yum install dsc30
macOS
# Install Homebrew package manager
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install Cassandra
brew install cassandra
# Run Cassandra service
brew services start cassandra
Example
Let's take an example of installing Cassandra on Ubuntu 18.04 LTS:
# Add the Cassandra repository
echo "deb http://www.apache.org/dist/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
# Add the repository keys
curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
# Update the package index and install Cassandra
sudo apt update
sudo apt install cassandra
Output
Once the installation is complete, you can check the status of the Cassandra service using the following command:
sudo systemctl status cassandra
You should see a message confirming that the Cassandra service is active and running.
● cassandra.service - LSB: distributed storage system for structured data
Loaded: loaded (/etc/init.d/cassandra; generated)
Active: active (exited) since Tue 2021-09-28 10:22:26 UTC; 1min 47s ago
Docs: man:systemd-sysv-generator(8)
Tasks: 0 (limit: 2362)
Memory: 0B
CGroup: /system.slice/cassandra.service
Sep 28 10:22:26 ubuntu systemd[1]: Starting LSB: distributed storage system for structured data...
Sep 28 10:22:26 ubuntu systemd[1]: Started LSB: distributed storage system for structured data.
Explanation
The steps for installing Cassandra on different platforms are different, but the general idea remains the same. We need to add the Cassandra repository, add the repository keys, update the package index, and install Cassandra.
On Debian/Ubuntu, we add the Cassandra repository to /etc/apt/sources.list.d/cassandra.sources.list
, import the repository keys, update the package index, and install Cassandra using the apt
package manager.
On CentOS/RHEL, we add the DataStax repository, enable it, and install Cassandra using the yum
package manager.
On macOS, we install the Homebrew package manager if it is not already installed, and then use it to install Cassandra.
Use
Cassandra is a popular choice for organizations that work on big data and require a distributed storage system to handle large amounts of data across many commodity servers. Cassandra is used by companies such as Netflix and Reddit for its scalability and performance.
Important Points
- Always verify the authenticity of the repository before adding it to your system.
- Always install software from trusted sources.
- Follow the instructions for your particular operating system and distribution.
- Make sure your system meets the minimum requirements for running Cassandra.
Summary
Cassandra is a popular distributed NoSQL database management system that is designed to handle large amounts of data across many commodity servers. In this tutorial, we walked through the installation process for Cassandra on different operating systems. We saw the general steps involved in installation, as well as the specific commands required for each platform. Cassandra is a powerful tool for handling big data, and its popularity is evident in the large number of companies that use it to manage their data.