How to Install Apache Cassandra NoSQL Database on a Single-Node Ubuntu 22.04 Cluster

 

 

Apache Cassandra is a highly scalable NoSQL database designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. In this guide, we will walk you through the steps to install Apache Cassandra on a single-node cluster running Ubuntu 22.04. Whether you are deploying it on a local server or using a Windows VPS UK, this tutorial covers all the necessary steps.

Step 1: Update Your System

Before installing Cassandra, ensure your system is up to date. Run the following commands:

sudo apt update && sudo apt upgrade -y

Keeping your system updated is crucial for security and performance, whether you're setting it up locally or on a VPS Windows Servers platform.

Step 2: Install Java

Apache Cassandra requires Java. Install OpenJDK by running:

sudo apt install openjdk-11-jdk -y

Verify the Java installation:

java -version

Step 3: Add the Cassandra Repository

Add the Apache Cassandra repository to your system:


echo "deb https://apache.claz.org/cassandra/debian/ 40x main" | sudo tee /etc/apt/sources.list.d/cassandra.sources.list
curl -fsSL https://apache.claz.org/cassandra/KEYS | sudo apt-key add -
            

Step 4: Install Cassandra

Update the package list and install Cassandra:

sudo apt update
sudo apt install cassandra -y

Step 5: Start Cassandra

Start the Cassandra service and enable it to run on boot:

sudo systemctl start cassandra
sudo systemctl enable cassandra

Step 6: Verify Cassandra Installation

You can verify that Cassandra is running by checking its status:

sudo systemctl status cassandra

You should see the service as "active (running)".

Step 7: Access Cassandra Shell

To access the Cassandra Query Language shell (CQLSH), run:

cqlsh

This will connect you to the default keyspace and allow you to run queries.

Step 8: Create a Keyspace

You can create a keyspace by running the following command in CQLSH:

CREATE KEYSPACE my_keyspace WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1};

Replace my_keyspace with your desired keyspace name.

Step 9: Create a Table

To create a table within your keyspace, use:

USE my_keyspace;
CREATE TABLE users (id UUID PRIMARY KEY, name text, email text);

Step 10: Insert Data into the Table

To insert data into your table, run:

INSERT INTO users (id, name, email) VALUES (uuid(), 'John Doe', '[email protected]');

Step 11: Query Data from the Table

To query the data you just inserted, use:

SELECT * FROM users;

You have successfully installed Apache Cassandra on your Ubuntu 22.04 server, allowing you to manage your NoSQL database effectively. For reliable and scalable hosting solutions, consider using Windows VPS UK. They offer a variety of hosting options, including windows virtual private servers, windows vps hosting, and windows virtual dedicated server hosting. Whether you're looking for windows vps italy or uk vps windows solutions, their hosting services provide the performance and flexibility needed to support your database management needs.

  • 0 أعضاء وجدوا هذه المقالة مفيدة
هل كانت المقالة مفيدة ؟

مقالات مشابهة

Boost Your Ubuntu System's Performance with a Swap File: A Step-by-Step Guide

What is a Swap File? A swap file in Ubuntu serves as dedicated virtual memory on your hard...

How to Migrate ISPConfig 2, ISPConfig 3.x, Confixx, CPanel or Plesk to ISPConfig 3.2 (single server)

Introduction Migration from other control panels like ISPConfig 2, ISPConfig 3.x, Confixx,...

How to Install and Configure Zabbix Server and Client on Rocky Linux 9

Introduction Zabbix is an open-source monitoring solution that provides real-time...

How to Install CockroachDB Cluster on Debian 12

Introduction CockroachDB is a distributed SQL database built to handle large-scale,...

How to Install Joomla with Apache and Let's Encrypt SSL on AlmaLinux 9

Introduction Joomla is a popular open-source content management system (CMS) used to build...