Apache Cassandra is a robust, high-performance NoSQL database designed to manage large amounts of structured data across several commodity servers. It offers strong consistency and high availability by replicating data across multiple nodes, eliminating any single point of failure.
Pre-installation Requirements
Before proceeding with the installation, let’s ensure that your system meets all necessary requirements:
- A server running Fedora 39.
- Access to the terminal for executing commands. Fedora 39 provides the Terminal application, found in your Applications menu.
- A network connection to download the Apache Cassandra repository.
- A
non-root sudo user
or access to theroot user
. For safety, it’s advised to operate as anon-root sudo user
.
Updating Fedora 39
Begin by updating your Fedora 39 system. This will ensure all existing packages are current, and the system repo cache is refreshed. Use the following command:
sudo dnf clean all sudo dnf update
Installing Java
As Cassandra is written in Java, it’s crucial to have Java installed on your system. Use the following command to install Java:
sudo dnf install java-11-openjdk
Then, verify the Java version with:
java -version
Installing Python
Fedora typically comes with Python pre-installed. To verify, type:
python --version
If Python is not installed or you wish to upgrade to the latest version, use Fedora’s dnf
tool to install Python 3:
sudo dnf install python3
To verify the installation, type:
python3 --version
Installing Apache Cassandra on Fedora 39
First, add the official Apache Cassandra repository to YUM. This contains the latest 4.1 version RPM packages built for Fedora.
Create a new YUM repo file /etc/yum.repos.d/cassandra.repo
with the following configuration:
[cassandra] name = Apache Cassandra baseurl = https://downloads.apache.org/cassandra/redhat/41x/ gpgcheck = 1 repo_gpgcheck = 1 gpgkey = https://downloads.apache.org/cassandra/KEYS
The repository definition contains the base URL to download the Cassandra 4.1 RPM packages. GPG check is enabled to verify the packages’ signatures.
With the repository configured, install Apache Cassandra using the DNF package manager:
sudo dnf update sudo dnf install cassandra
You can confirm that Cassandra is installed with:
$ cassandra -v Apache Cassandra 4.1.0
Install additional Python driver packages with:
sudo dnf install python-cql python3-cql
Start the service and enable automatic startup on boot using systemctl
:
sudo systemctl start cassandra sudo systemctl enable cassandra
Verifying the Cassandra Installation
You can verify if Cassandra is installed correctly and accessible through cqlsh
:
cqlsh
This will connect to the running Cassandra instance using the native query language shell. Run a few sample CQL statements to check connectivity:
DESCRIBE KEYSPACES; SELECT cluster_name, listen_address FROM system.local;
If cqlsh
connects and runs queries successfully, your Cassandra installation is ready!
Post-Installation Configuration
Cassandra Configuration File
The core configuration file is /etc/cassandra/default.conf/cassandra.yaml
. This controls the cluster name, data storage locations, JVM settings, backups, security, and more. Common settings to configure include:
- Cluster name
- Listen to address
- Seed node IP addresses
- Data file directories
- Commit log directory
- Authenticator and authorizer
Make any changes to cassandra.yaml
and restart the service for settings to take effect.
Cassandra Data Storage
By default, Cassandra’s table data is stored under /var/lib/cassandra/data
while commit logs are under /var/lib/cassandra/commitlog
.
These storage locations can be customized in cassandra.yaml
. Ensure your data disks have enough IOPS and throughput to handle read/write operations. SSDs are best for fast performance.
Cassandra Logs
Logs are crucial for monitoring, auditing, and troubleshooting. Cassandra stores system.log, debug.log, and gc.log under /var/log/cassandra
.
Rotate logs periodically and ship them to a centralized logging server for analysis. Log data can provide valuable insights into query patterns, performance issues, etc.
If you don’t have time to do all of this stuff, or if this is not your area of expertise, Shape.host offers a “VPS Manage Service Offer”, starting from $4. They provide reliable and secure Cloud VPS solutions, ensuring your system runs smoothly and efficiently. Check them out for the best deals!