If you want to deploy a database capable of handling massive amounts of unstructured data, Apache Cassandra might do the trick. Jack Wallen shows you how to deploy this NoSQL database on AlmaLinux.
Apache Cassandra is a very powerful NoSQL database that is perfectly at home driving big data. This particular database provides linear scalability, high availability and serious performance. With Apache Cassandra, your business can process large volumes of fast-moving data reliably.
SEE: Hiring Kit: Database engineer (TechRepublic Premium)
If businesses like Facebook, Instagram and Netflix can depend on Apache Cassandra, I’m betting your company could as well.
Let me walk you through the process of installing Apache Cassandra. I’ll be demonstrating on AlmaLinux 8 which can be deployed on bare metal in your data center or via a third-party cloud host (such as Google Cloud, AWS and Azure).
What you’ll need
The only things you’ll need to get Apache Cassandra up and running are an instance of AlmaLinux and a user with sudo privileges. That’s it … let’s make this happen.
How to install the necessary dependencies
The first thing we’ll do is install the necessary dependencies for Apache Cassandra. Log into your AlmaLinux server and update dnf with the command:
sudo dnf update
Once that completes, install the next set of dependencies with:
sudo dnf install yum-utils epel-release -y
After those two package installations are complete, enable PowerTools (so we can install the necessary Java package) with:
sudo dnf config-manager --set-enabled powertools
Install OpenJDK with:
sudo dnf install java-11-openjdk -y
If you find Java 11 causes problems with your installation (I’ve had this happen on a couple of occasions), opt for a Java 8 installation with:
sudo dnf install java-1.8.0-openjdk -y
How to create the Apache Cassandra repository file
Next, we’ll create the Apache Cassandra repository file with:
sudo nano /etc/yum.repos.d/cassandra.repo
In that file, paste the following content:
Save and close the file.
Update dnf with:
sudo dnf update -y
How to install Apache Cassandra
We can now install Apache Cassandra with the command:
sudo dnf install cassandra -y
After the installation completes, start and enable the service with:
sudo systemctl start cassandra
sudo systemctl enable cassandra
It will take a minute or so for the Cassandra node to appear. Check the status with:
In the output, you should see something like that shown in Figure A.
You can then access the Apache Cassandra console with the command:
By default, the cluster name will be something like Test Cluster. To rename the cluster issue the command (in the Apache Cassandra console):
UPDATE system.local SET cluster_name="NAME" WHERE KEY = 'local';
Where NAME is the new name for the cluster. Exit the console with the exit command and then log back in to see the new name listed (Figure B).
That will only be temporary. When the service restarts, the name will revert to Test Cluster. To make that change permanent, open the configuration file with:
sudo nano /etc/cassandra/default.conf/cassandra.yaml
Look for the line:
cluster_name: 'Test Cluster'
Test Cluster to whatever you want to name your Apache Cassandra cluster. Save and close the file. Flush the cache and restart Apache Cassandra with the following commands:
nodetool flush system
sudo sytemctl restart cassandra
Now, when the service (or the server) restarts, the name will stick. Remember, however, that after restarting the service, it can take some time for it to come back up.
Congratulations, you now have the Apache Cassandra NoSQL database server up and running and are ready to start building databases like a pro.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.