APACHE CASSANDRA
Introduction, Installation and
Basic CQL Commands
AIM
To study Apache Cassandra, install Cassandra on the system, and execute basic CQL commands such as creating a keyspace, table, inserting and retrieving data.
SOFTWARE REQUIREMENTS
-
Operating System: Windows / Linux / Ubuntu
-
Apache Cassandra 4.x
-
Java JDK 8 or 11
-
Python (Optional for cqlsh)
-
Docker (Optional)
THEORY
1. Apache Cassandra
Apache Cassandra is an open-source, distributed, NoSQL database designed to handle large volumes of data across multiple servers with no single point of failure.
Key Features
-
Peer-to-peer architecture
-
High write performance
-
Column-family based storage
-
Horizontal scalability
-
Tunable consistency
-
Replication across data centers
2. Cassandra Architecture Components
| Component | Description |
|---|---|
| Node | Basic unit of storage |
| Cluster | Collection of multiple nodes |
| Data Center | Logical grouping of nodes |
| Keyspace | Equivalent to database |
| Column Family (Table) | Structure to store rows |
| Partition Key | Determines data distribution |
| Replication Factor | Number of copies of data |
3. Installation Procedure
A. Installation on Ubuntu / Linux
Step 1: Update System
Step 2: Install Java
Step 3: Add Cassandra Repository
Step 4: Add Repository Key
Step 5: Install Cassandra
Step 6: Start Service
Step 7: Open CQL Shell
B. Installation on Windows
(Not officially supported but works with binaries)
Steps
-
Install Java 8 or 11
-
Download Cassandra ZIP
-
Extract to
C:\cassandra -
Add
C:\cassandra\binto PATH -
Run:
-
Open shell:
⭐ Basic Cassandra CQL Commands
AIM
To execute Cassandra Query Language (CQL) commands for keyspace creation, table creation, insertion, updating, deletion, and selection.
COMMANDS & PROCEDURE
1. Create a Keyspace
2. Use the Keyspace
3. Create a Table
4. Insert Records
5. Select Records
6. Update Records
7. Delete a Record
8. Drop Table
9. Drop Keyspace
⭐ OBSERVATION
-
Keyspace was created successfully.
-
Table was created with columns id, name, age, marks.
-
Data was inserted and retrieved using CQL commands.
-
Cassandra shell executed commands without errors.
⭐ RESULT
The installation of Apache Cassandra was completed, and basic CQL commands for creating keyspace, table, inserting, updating, deleting, and retrieving records were successfully executed.
Comments
Post a Comment