In Cassandra Lunch #70, we discuss the Basics of Apache Cassandra and setup a stand-alone Apache Cassandra.
Accompanying Blog: https://blog.anant.us/cassandra-launch-70-basics-of-apache-cassandra
Accompanying YouTube: https://youtu.be/o-yU0mi4nzc
Sign Up For Our Newsletter: http://eepurl.com/grdMkn
Join Cassandra Lunch Weekly at 12 PM EST Every Wednesday: https://www.meetup.com/Cassandra-DataStax-DC/events/
Cassandra.Link:
https://cassandra.link/
Follow Us and Reach Us At:
Anant:
https://www.anant.us/
Awesome Cassandra:
https://github.com/Anant/awesome-cassandra
Cassandra.Lunch:
https://github.com/Anant/Cassandra.Lunch
Email:
solutions@anant.us
LinkedIn:
https://www.linkedin.com/company/anant/
Twitter:
https://twitter.com/anantcorp
Eventbrite:
https://www.eventbrite.com/o/anant-1072927283
Facebook:
https://www.facebook.com/AnantCorp/
Join The Anant Team:
https://www.careers.anant.us
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Apache Cassandra Lunch #70: Basics of Apache Cassandra
1. Version 1.0
Basics of Apache Cassandra
In Cassandra Lunch #70, we will discuss the Basics of Apache
Cassandra and setup a stand-alone Apache Cassandra.
Isaac Omolayo
Jr. Software Engineer
@Anant
2. Introduction
● What is Apache Cassandra
● Why do we need Apache Cassandra ?
● Features of Cassandra
● Apache Cassandra Installation guide
● Write data into Cassandra
3. What is Apache Cassandra
● Apache Cassandra is a fast, distributed database built for high available and for linear scalability
● No single point of failure because there is a peer-to-peer technology, everyone has the same ability, no master or slave
relationship
● Data is automatically replicated
● CQL is used for data definition
and Manipulation
4. Why do we need Apache Cassandra?
● Open Source
○ Open source non-relational database that is attractive because they are affordable and extensible
○ More companies are adopting Apache Cassandra
● Elastic Scalability
○ You can scale horizontally by adding more nodes to the cluster
● Highly Available
○ Is a distributed and decentralized system
○ No single point of failure
● Simple Cassandra Query Language with an opportunity for flexible dynamic data structures
○ Apache Cassandra supports ACID compliance in transactions
● Apache Cassandra is easy to manage
● Can handle Structured and Unstructured data
5. Design Architecture of Apache Cassandra
Apache Cassandra is designed such that it has no master or slave nodes. It has a ring-type architecture, that is, its nodes are logically
distributed like a ring. Data is automatically distributed across all the nodes.
★ Cluster (s)
★ Data Centers
★ Racks
★ Servers
★ Nodes (V - Nodes)
6. CAP theorem in Cassandra
● CAP theorem states that a database can’t simultaneously guarantee consistency, availability, and partition tolerance.
7. CAP theorem in Cassandra
● All Nodes in Cassandra communicates with each other through a peer-to-peer communication protocol called Gossip
Protocol that broadcasts information about data and nodes health.
8. Apache Cassandra Installation Guide
● There are different methods of installing Cassandra that are common:
○ Docker Image:
■ Installing Cassandra is simple using Docker. You’ll need to install Docker Desktop for Mac, Docker Desktop
for Windows, or have docker installed on Linux. Pull the appropriate image and then start Cassandra with a
run command
■ docker pull cassandra:latest
■ docker run --name anant_database cassandra:latest
■ docker exec -it anant_database cqlsh
○ Using Tarball Binary File:
■ The tarball unpacks all its contents into a single location with binaries and configuration files located in their
own subdirectories. The most obvious attribute of the tarball installation is it does not require root
permissions and can be installed on any Linux distribution
○ Package installation (RPM, YUM)
■ Install the RPM build on CentOS and RHEL-based distributions if you want to install Cassandra using YUM.
Install the Debian build on Ubuntu and other Debian-based distributions if you want to install Cassandra
using APT. Both the YUM and APT methods required root permissions.
9. Write Data to Cassandra
● -- Create a keyspace
CREATE KEYSPACE IF NOT EXISTS voting_system WITH REPLICATION = {'class':'SimpleStrategy', 'replication_factor':'1'};
● -- Create a table
CREATE TABLE IF NOT EXISTS voting_system.voters (
votersid UUID,
voterstime TIMESTAMP,
name TEXT,
city TEXT,
state TEXT,
supporting TEXT,
PRIMARY KEY((votersid), name));
● -- Insert some data into your table
INSERT INTO voting_system.voters (votersid, voterstime, name, city , state, supporting) VALUES
(uuid() , toTimeStamp(now()), 'Jackson', 'Bredforte', 'California', 'A');
INSERT INTO voting_system.voters (votersid, voterstime, name, city , state, supporting) VALUES
(uuid() , toTimeStamp(now()), 'Bond', 'Jasper', 'Arizona', 'B');
10. Demo
● Set up Cassandra using Docker
● Remote into the Docker Container
● Create Keyspace
● Create a Table in Cassandra
● Write Data into the Cassandra Database