SlideShare ist ein Scribd-Unternehmen logo
1 von 55
Downloaden Sie, um offline zu lesen
Apache Cassandra
Database
Software Engineering Branch
2
Charfaoui Younes & Bourbai Ismail
Database Administration class
BENATHMANE Lalia
👩
Hello!
Today we’re going to present the
ins and outs of Cassandra database.
3
Our process is
easy
4
first
Introduction
Basic of NoSQL, cassandra and
the instalation process
Key Principles
The Different aspects of the
Cassandra database
second
Demo Example
An demo illustrating basics of
Cassandra query language
third
Debate
Strenghs and Weaknesses, and
some questions
last
Introduction
Let’s start with some definitions.
1
“
6
I don’t always use Cassandra,
But when I do, I denormalize
-Meme.
NoSQL Databases
A NoSQL database (Not Only SQL) is a database that provides
a mechanism to store and retrieve data other than the tabular
relations used in relational databases. These databases are
schema-free, support easy replication, have simple API,
eventually consistent, and can handle huge amounts of data.
7
NoSQL Databases
In general, they share the following features:
● Schema-free databases
● Easy replication support
● Simple API
● Distributed
8
● Open Source
● BASE (instead of ACID)
● Huge amount of data
● Horizontally scalable
Apache Cassandra
A distributed NoSQL database
system for managing large
amounts of structured data
across many commodity servers,
while providing highly available
service and no single point of
failure.
9
Caracteristics
10
Data security
Limitation
of the
roundness
Speed of
access
Verification
of integrity
Manipulability
Physical
independence
Data sharing
Cassandra support most of the General DBMS characteristics
The
Instalation
To strat using cassandra we need to set a
workplace for it first.
11
● The latest version of Java 8
● The latest version of Python 2.7 or 3.6
● Download the Software (DataStax Community Edition
for Apache Cassandra™)
Requirements:
12
13
You can use DataGrip for interacting with the database
instead of the CQLSH, but it does require a license key for
using it.
Additional Tool:
14
https://www.jetbrains.com/datagrip/
15
2 - Connection name
1 – Choose Cassandra
3 – Key Space Name
Key Principles
The “Must” Be understood of the cassandra
2
Key
Features
17
High
Performance
Distributed
&
Decentralized
Elastic
Scalability
Fault
Tolerance
Tunable
Consistency
Column
oriented
CQL query
interface
This features makes the
Cassandra Empire !
Distributed &
Decentralized
● Distributed: Capable of
running on multiple machines
● Decentralized: No single point
of failure
● No master-slave issues due to
peer-to-peer architecture
(protocol "gossip")
18
Read- and write-requests
to any node
Elastic
Scalability
● Cassandra scales horizontally,
adding more machines that
have all or some of the data on
● Adding of nodes increase
performance throughput
linearly
● Decreasing and increasing the
node count happen seamlessly
19
Linearly scales to terabytes
and petabytes of data
High Availability &
Fault Tolerance
High Availability?
● Multiple networked computers
operating in a cluster
● Facility for recognizing node
failures
● Forward failing over requests
to another part of the system
20
No single point of failure
due to the peer-to-peer
architecture
Column oriented
Key-Value Store
● Data is stored in sparse
multidimensional hash tables
● A row can have multiple columns
not necessarily the same amount
of columns for each row
● Each row has a unique key, which
also determines partitioning
21
No relations!
R1 C1 Key C2 Key C3Key
…..
C1 Value C3 Value C3 Value
R2 C4 Key C5 Key
C4 Value C5 Value
…….
Cassandra Query Language
22
“SQL-like” but NOT
relational SQL
● “CQL 3 is the default and primary interface into the
Cassandra DBMS”
● Familiar SQL-like syntax that maps to Cassandras storage
engine and simplifies data modelling
Cassandra Query Language
CRETE TABLE songs (
Id uuid PRIMARY KEY, title text,
Album text, Artist text,
data blob );
23
INSERT INTO songs (id, title, album, artist)
VALUES( 'a3e64f8f...', ‘Hazim ra3d', ‘Spacetoon', ‘Tarkan‘ );
SELECT * FROM songs ;
SELECT * FROM songs
WHERE id = 'a3e64f8f...';
Cassandra Query Language
24
INSERT INTO songs (id, title)
VALUES( 'a3e64f8f...', ‘Al Kanas');
This is Possible With Cassandra
😋
Cassandra Query Language
25
The resulting table in RDMBS is this:
id title artist album data
a3e64f8f… Hazim Ra3d Tarkan Spacetoon null
g617Dd23… Al Kanas null null null
Cassandra Query Language
26
The resulting table in Cassandra is this:
id title artist album data
a3e64f8f… Hazim Ra3d Tarkan Spacetoon
g617Dd23… Al Kanas
MySQL Comparision:
Cassandra MySQL
Average Write 0.12 ms ~300 ms
Average Read 15 ms ~350 ms
27
Statistics based on 50 GB Data
Stats provided by Authors using Facebook data.
And Much More…
28
The Data
Model
How the Database is Organized ?
29
Data Model
Cluster:
Cassandra database is distributed over several machines that operate
together. The outermost container is known as the Cluster. For failure
handling, every node contains a replica, and in case of a failure, the replica
takes charge. Cassandra arranges the nodes in a cluster, in a ring format, and
assigns data to them.
30
Data Model
Keyspace
Outermost container
for data (one or more
column families), like
database in RDBMS.
Column family
Contains Super
columns or Columns
(but not both).
Column
Basic data structures
with: key, value,
timestamp
31
Data Model
32
Keyspace
Settings
Column Family
Settings
Column
key value timestamp
🌏
Demo
Example illustrating different part of CQL
3
Examples Using
CQL
The Following Slides will
demonstrate different cases with
different CQL interfaces like DDL,
DML etc..
34
User
• Id
• Name
• Phone
• Age
Emails
• Id
• email
35
• Type
• Keyspace , Table
• Index , Trigger
DROP
• Type
• Keyspace , Table
• Index , Trigger
CREATE
• Type
• Keyspace , Table
• Index , Trigger
ALTER
Same as SQL, but with
keyspaces and types
option added.
Interface DDL
Interface DML
36
SELECT INSERT
UPDATE DELETE
DML
The DML Interface is
the Same With
Normal SQL DML
Interface DCL
37
VIEW
LIST USERS LIST PERMISSION
PERMISSION
GRANT REVOKE
USER
CREATE DROP ALTER
Create users (Roles),
give them permission,
and start using them.
Interface TCL
38
APPLY
BATCH
END
DMLs
OPERATIONS
BEGIN
BATCH
START
For multiple
operations use the
BATCH command
Metadata
& Logging
How to see metadata and make logging in
Cassandra database ?
39
Metadata Using Describe
40
Describe keyspace name
Describe table keyspace__name .table_name
Describe keyspaces, tables, schema
keyspace
Table
Others
Metadata Keyspace
Query the defined key spaces using the SELECT statement.
41
SELECT * FROM
system________schema._keyspaces
keyspace__name durable__writes replication
test True {'class': 'org.apache'}….
…… …… ……
Metadata Tables
Getting information about tables in the test keyspace.
42
SELECT * FROM system__schema.tables
WHERE keyspace_name = test';
keyspace__name table__name …….
test users ……..
…… …… ……
Metadata Columns
Getting information about columns in the users tables.
43
SELECT * FROM system_schema.columns
WHERE keyspace__name = test' AND table_name = 'users';
table__name column___name kind type …….
users age regular int ……..
…… …… …… …… ……
Logging with System.log
To see what is happening in the database, you can use the
system.log file in the Cassandra home to directory to track
creational query.
44
{CASSANDRA HOME}/utils/cassandra.logdir_IS_UNDEFINED/
{CASSANDRA HOME}/utils/cassandra.logdir_IS_UNDEFINED/
Here is an Example
Logging with System.log
45
INFO [main] 2018-11-08 23:48:36,960
MigrationManager.java:302 - Create new Keyspace:
KeyspaceMetadata {name=system_traces,
params=KeyspaceParams {durable_writes=true,
replication=ReplicationParams
{class=org.apache.cassandra.locator.SimpleStrategy,
replication_factor=2 }
Here is an Example
Logging with Tracing
46
TRACING [ ON | OFF]
It’s an option to activate in the Cassandra database
The result will be on different keyspace called system__traces. In
a table called events
USE system_traces;
SELECT * FROM events;
Logging with Tracing
47
INSERT INTO product(id , name) VALUES (UUID(), 'Hello');
Example:
Execute CQL3 query
Parsing insert into product(id , name) values(UUID(), 'Hello');
Preparing statement
……
Result:
Debate
Strength and weakness of Cassandra.
4
Strengths (1)
● Linear scale performance
The ability to add nodes without failures leads to predictable
increases In performance
● Supports multiple languages
Python, C#/.NET, C++, Ruby, Java, Go, and many more…
● Operational and developmental simplicity
There are no complex software tiers to be managed, so
administration duties are greatly simplified.
49
Strengths (2)
● Ability to deploy across data centers
Cassandra can be deployed across multiple, geographically
dispersed data centers
● Cloud availability
Installations in cloud environments
● Peer to peer architecture
Cassandra follows a peer-to-peer architecture, instead of
master-slave architecture
50
Strengths (3)
● Flexible data model
Supports modern data types with fast writes and reads
● Fault tolerance
Nodes that fail can easily be restored or replaced
● High Performance
Cassandra has demonstrated brilliant performance under
large sets of data
51
Strengths (4)
● Schema-free/Schema-less
In Cassandra, columns can be created at your will within the
rows. Cassandra data model is also famously known as a
schema-optional data model
● AP-CAP
Cassandra is typically classified as an AP system, meaning
that availability and partition tolerance are generally
considered to be more important than consistency in
Cassandra
52
Weaknesses (1)
Use Cases where is better to avoid using Cassandra
● If there are too many joins required to retrieve the data
● To store configuration data
● During compaction, things slow down and throughput
degrades
● Basic things like aggregation operators are not supported
● Range queries on partition key are not supported
53
Weaknesses (2)
Use Cases where is better to avoid using Cassandra
● If there are transactional data which require 100%
consistency
● Cassandra can update and delete data but it is not
designed to do so
54
55
Thanks!
Any questions?

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction to Cassandra Basics
Introduction to Cassandra BasicsIntroduction to Cassandra Basics
Introduction to Cassandra Basicsnickmbailey
 
SQL Server High Availability and Disaster Recovery
SQL Server High Availability and Disaster RecoverySQL Server High Availability and Disaster Recovery
SQL Server High Availability and Disaster RecoveryMichael Poremba
 
Spark + Cassandra = Real Time Analytics on Operational Data
Spark + Cassandra = Real Time Analytics on Operational DataSpark + Cassandra = Real Time Analytics on Operational Data
Spark + Cassandra = Real Time Analytics on Operational DataVictor Coustenoble
 
Introduction to Cassandra Architecture
Introduction to Cassandra ArchitectureIntroduction to Cassandra Architecture
Introduction to Cassandra Architecturenickmbailey
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introductionPooyan Mehrparvar
 
Indexing with MongoDB
Indexing with MongoDBIndexing with MongoDB
Indexing with MongoDBMongoDB
 
Appache Cassandra
Appache Cassandra  Appache Cassandra
Appache Cassandra nehabsairam
 
Cql – cassandra query language
Cql – cassandra query languageCql – cassandra query language
Cql – cassandra query languageCourtney Robinson
 
Apache Cassandra at the Geek2Geek Berlin
Apache Cassandra at the Geek2Geek BerlinApache Cassandra at the Geek2Geek Berlin
Apache Cassandra at the Geek2Geek BerlinChristian Johannsen
 
Apache Spark in Depth: Core Concepts, Architecture & Internals
Apache Spark in Depth: Core Concepts, Architecture & InternalsApache Spark in Depth: Core Concepts, Architecture & Internals
Apache Spark in Depth: Core Concepts, Architecture & InternalsAnton Kirillov
 
Introduction to NoSQL Databases
Introduction to NoSQL DatabasesIntroduction to NoSQL Databases
Introduction to NoSQL DatabasesDerek Stainer
 
Introduction to cassandra
Introduction to cassandraIntroduction to cassandra
Introduction to cassandraNguyen Quang
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & FeaturesDataStax Academy
 
Bulk Loading into Cassandra
Bulk Loading into CassandraBulk Loading into Cassandra
Bulk Loading into CassandraBrian Hess
 
Intro to cassandra
Intro to cassandraIntro to cassandra
Intro to cassandraAaron Ploetz
 

Was ist angesagt? (20)

Introduction to Cassandra Basics
Introduction to Cassandra BasicsIntroduction to Cassandra Basics
Introduction to Cassandra Basics
 
SQL Server High Availability and Disaster Recovery
SQL Server High Availability and Disaster RecoverySQL Server High Availability and Disaster Recovery
SQL Server High Availability and Disaster Recovery
 
Spark + Cassandra = Real Time Analytics on Operational Data
Spark + Cassandra = Real Time Analytics on Operational DataSpark + Cassandra = Real Time Analytics on Operational Data
Spark + Cassandra = Real Time Analytics on Operational Data
 
Introduction to Cassandra Architecture
Introduction to Cassandra ArchitectureIntroduction to Cassandra Architecture
Introduction to Cassandra Architecture
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introduction
 
MS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTUREMS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTURE
 
Postgresql
PostgresqlPostgresql
Postgresql
 
PostgreSQL
PostgreSQLPostgreSQL
PostgreSQL
 
Cassandra NoSQL Tutorial
Cassandra NoSQL TutorialCassandra NoSQL Tutorial
Cassandra NoSQL Tutorial
 
Indexing with MongoDB
Indexing with MongoDBIndexing with MongoDB
Indexing with MongoDB
 
Appache Cassandra
Appache Cassandra  Appache Cassandra
Appache Cassandra
 
Cql – cassandra query language
Cql – cassandra query languageCql – cassandra query language
Cql – cassandra query language
 
NoSQL databases
NoSQL databasesNoSQL databases
NoSQL databases
 
Apache Cassandra at the Geek2Geek Berlin
Apache Cassandra at the Geek2Geek BerlinApache Cassandra at the Geek2Geek Berlin
Apache Cassandra at the Geek2Geek Berlin
 
Apache Spark in Depth: Core Concepts, Architecture & Internals
Apache Spark in Depth: Core Concepts, Architecture & InternalsApache Spark in Depth: Core Concepts, Architecture & Internals
Apache Spark in Depth: Core Concepts, Architecture & Internals
 
Introduction to NoSQL Databases
Introduction to NoSQL DatabasesIntroduction to NoSQL Databases
Introduction to NoSQL Databases
 
Introduction to cassandra
Introduction to cassandraIntroduction to cassandra
Introduction to cassandra
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & Features
 
Bulk Loading into Cassandra
Bulk Loading into CassandraBulk Loading into Cassandra
Bulk Loading into Cassandra
 
Intro to cassandra
Intro to cassandraIntro to cassandra
Intro to cassandra
 

Ähnlich wie Cassandra Database

Cassandra implementation for collecting data and presenting data
Cassandra implementation for collecting data and presenting dataCassandra implementation for collecting data and presenting data
Cassandra implementation for collecting data and presenting dataChen Robert
 
Cassandra - A Distributed Database System
Cassandra - A Distributed Database System Cassandra - A Distributed Database System
Cassandra - A Distributed Database System Md. Shohel Rana
 
Cassandra - A decentralized storage system
Cassandra - A decentralized storage systemCassandra - A decentralized storage system
Cassandra - A decentralized storage systemArunit Gupta
 
cassandra
cassandracassandra
cassandraAkash R
 
CASSANDRA A DISTRIBUTED NOSQL DATABASE FOR HOTEL MANAGEMENT SYSTEM
CASSANDRA A DISTRIBUTED NOSQL DATABASE FOR HOTEL MANAGEMENT SYSTEMCASSANDRA A DISTRIBUTED NOSQL DATABASE FOR HOTEL MANAGEMENT SYSTEM
CASSANDRA A DISTRIBUTED NOSQL DATABASE FOR HOTEL MANAGEMENT SYSTEMIJCI JOURNAL
 
04-Introduction-to-CassandraDB-.pdf
04-Introduction-to-CassandraDB-.pdf04-Introduction-to-CassandraDB-.pdf
04-Introduction-to-CassandraDB-.pdfhothyfa
 
Cassandra for mission critical data
Cassandra for mission critical dataCassandra for mission critical data
Cassandra for mission critical dataOleksandr Semenov
 
Cassandra - A Basic Introduction Guide
Cassandra - A Basic Introduction GuideCassandra - A Basic Introduction Guide
Cassandra - A Basic Introduction GuideMohammed Fazuluddin
 
Tales From The Front: An Architecture For Multi-Data Center Scalable Applicat...
Tales From The Front: An Architecture For Multi-Data Center Scalable Applicat...Tales From The Front: An Architecture For Multi-Data Center Scalable Applicat...
Tales From The Front: An Architecture For Multi-Data Center Scalable Applicat...DataStax Academy
 
Storage cassandra
Storage   cassandraStorage   cassandra
Storage cassandraPL dream
 
Cassandra
Cassandra Cassandra
Cassandra Pooja GV
 
cassandra_presentation_final
cassandra_presentation_finalcassandra_presentation_final
cassandra_presentation_finalSergioBruno21
 
Trivadis TechEvent 2016 Big Data Cassandra, wieso brauche ich das? by Jan Ott
Trivadis TechEvent 2016 Big Data Cassandra, wieso brauche ich das? by Jan OttTrivadis TechEvent 2016 Big Data Cassandra, wieso brauche ich das? by Jan Ott
Trivadis TechEvent 2016 Big Data Cassandra, wieso brauche ich das? by Jan OttTrivadis
 

Ähnlich wie Cassandra Database (20)

Cassandra implementation for collecting data and presenting data
Cassandra implementation for collecting data and presenting dataCassandra implementation for collecting data and presenting data
Cassandra implementation for collecting data and presenting data
 
Cassandra - A Distributed Database System
Cassandra - A Distributed Database System Cassandra - A Distributed Database System
Cassandra - A Distributed Database System
 
Cassandra Learning
Cassandra LearningCassandra Learning
Cassandra Learning
 
Cassandra - A decentralized storage system
Cassandra - A decentralized storage systemCassandra - A decentralized storage system
Cassandra - A decentralized storage system
 
cassandra
cassandracassandra
cassandra
 
CASSANDRA A DISTRIBUTED NOSQL DATABASE FOR HOTEL MANAGEMENT SYSTEM
CASSANDRA A DISTRIBUTED NOSQL DATABASE FOR HOTEL MANAGEMENT SYSTEMCASSANDRA A DISTRIBUTED NOSQL DATABASE FOR HOTEL MANAGEMENT SYSTEM
CASSANDRA A DISTRIBUTED NOSQL DATABASE FOR HOTEL MANAGEMENT SYSTEM
 
Cassndra (4).pptx
Cassndra (4).pptxCassndra (4).pptx
Cassndra (4).pptx
 
04-Introduction-to-CassandraDB-.pdf
04-Introduction-to-CassandraDB-.pdf04-Introduction-to-CassandraDB-.pdf
04-Introduction-to-CassandraDB-.pdf
 
Cassandra for mission critical data
Cassandra for mission critical dataCassandra for mission critical data
Cassandra for mission critical data
 
Cassandra - A Basic Introduction Guide
Cassandra - A Basic Introduction GuideCassandra - A Basic Introduction Guide
Cassandra - A Basic Introduction Guide
 
Tales From The Front: An Architecture For Multi-Data Center Scalable Applicat...
Tales From The Front: An Architecture For Multi-Data Center Scalable Applicat...Tales From The Front: An Architecture For Multi-Data Center Scalable Applicat...
Tales From The Front: An Architecture For Multi-Data Center Scalable Applicat...
 
No sql
No sqlNo sql
No sql
 
Cassandra
CassandraCassandra
Cassandra
 
Cassandra tutorial
Cassandra tutorialCassandra tutorial
Cassandra tutorial
 
Storage cassandra
Storage   cassandraStorage   cassandra
Storage cassandra
 
BigData Developers MeetUp
BigData Developers MeetUpBigData Developers MeetUp
BigData Developers MeetUp
 
Cassandra
Cassandra Cassandra
Cassandra
 
cassandra_presentation_final
cassandra_presentation_finalcassandra_presentation_final
cassandra_presentation_final
 
Trivadis TechEvent 2016 Big Data Cassandra, wieso brauche ich das? by Jan Ott
Trivadis TechEvent 2016 Big Data Cassandra, wieso brauche ich das? by Jan OttTrivadis TechEvent 2016 Big Data Cassandra, wieso brauche ich das? by Jan Ott
Trivadis TechEvent 2016 Big Data Cassandra, wieso brauche ich das? by Jan Ott
 
NoSql Database
NoSql DatabaseNoSql Database
NoSql Database
 

Kürzlich hochgeladen

Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFxolyaivanovalion
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystSamantha Rae Coolbeth
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% SecurePooja Nehwal
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxolyaivanovalion
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysismanisha194592
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxolyaivanovalion
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...Suhani Kapoor
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Delhi Call girls
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiSuhani Kapoor
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 

Kürzlich hochgeladen (20)

Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data Analyst
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFx
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
 

Cassandra Database

  • 2. Software Engineering Branch 2 Charfaoui Younes & Bourbai Ismail Database Administration class BENATHMANE Lalia 👩
  • 3. Hello! Today we’re going to present the ins and outs of Cassandra database. 3
  • 4. Our process is easy 4 first Introduction Basic of NoSQL, cassandra and the instalation process Key Principles The Different aspects of the Cassandra database second Demo Example An demo illustrating basics of Cassandra query language third Debate Strenghs and Weaknesses, and some questions last
  • 5. Introduction Let’s start with some definitions. 1
  • 6. “ 6 I don’t always use Cassandra, But when I do, I denormalize -Meme.
  • 7. NoSQL Databases A NoSQL database (Not Only SQL) is a database that provides a mechanism to store and retrieve data other than the tabular relations used in relational databases. These databases are schema-free, support easy replication, have simple API, eventually consistent, and can handle huge amounts of data. 7
  • 8. NoSQL Databases In general, they share the following features: ● Schema-free databases ● Easy replication support ● Simple API ● Distributed 8 ● Open Source ● BASE (instead of ACID) ● Huge amount of data ● Horizontally scalable
  • 9. Apache Cassandra A distributed NoSQL database system for managing large amounts of structured data across many commodity servers, while providing highly available service and no single point of failure. 9
  • 10. Caracteristics 10 Data security Limitation of the roundness Speed of access Verification of integrity Manipulability Physical independence Data sharing Cassandra support most of the General DBMS characteristics
  • 11. The Instalation To strat using cassandra we need to set a workplace for it first. 11
  • 12. ● The latest version of Java 8 ● The latest version of Python 2.7 or 3.6 ● Download the Software (DataStax Community Edition for Apache Cassandra™) Requirements: 12
  • 13. 13
  • 14. You can use DataGrip for interacting with the database instead of the CQLSH, but it does require a license key for using it. Additional Tool: 14 https://www.jetbrains.com/datagrip/
  • 15. 15 2 - Connection name 1 – Choose Cassandra 3 – Key Space Name
  • 16. Key Principles The “Must” Be understood of the cassandra 2
  • 18. Distributed & Decentralized ● Distributed: Capable of running on multiple machines ● Decentralized: No single point of failure ● No master-slave issues due to peer-to-peer architecture (protocol "gossip") 18 Read- and write-requests to any node
  • 19. Elastic Scalability ● Cassandra scales horizontally, adding more machines that have all or some of the data on ● Adding of nodes increase performance throughput linearly ● Decreasing and increasing the node count happen seamlessly 19 Linearly scales to terabytes and petabytes of data
  • 20. High Availability & Fault Tolerance High Availability? ● Multiple networked computers operating in a cluster ● Facility for recognizing node failures ● Forward failing over requests to another part of the system 20 No single point of failure due to the peer-to-peer architecture
  • 21. Column oriented Key-Value Store ● Data is stored in sparse multidimensional hash tables ● A row can have multiple columns not necessarily the same amount of columns for each row ● Each row has a unique key, which also determines partitioning 21 No relations! R1 C1 Key C2 Key C3Key ….. C1 Value C3 Value C3 Value R2 C4 Key C5 Key C4 Value C5 Value …….
  • 22. Cassandra Query Language 22 “SQL-like” but NOT relational SQL ● “CQL 3 is the default and primary interface into the Cassandra DBMS” ● Familiar SQL-like syntax that maps to Cassandras storage engine and simplifies data modelling
  • 23. Cassandra Query Language CRETE TABLE songs ( Id uuid PRIMARY KEY, title text, Album text, Artist text, data blob ); 23 INSERT INTO songs (id, title, album, artist) VALUES( 'a3e64f8f...', ‘Hazim ra3d', ‘Spacetoon', ‘Tarkan‘ ); SELECT * FROM songs ; SELECT * FROM songs WHERE id = 'a3e64f8f...';
  • 24. Cassandra Query Language 24 INSERT INTO songs (id, title) VALUES( 'a3e64f8f...', ‘Al Kanas'); This is Possible With Cassandra 😋
  • 25. Cassandra Query Language 25 The resulting table in RDMBS is this: id title artist album data a3e64f8f… Hazim Ra3d Tarkan Spacetoon null g617Dd23… Al Kanas null null null
  • 26. Cassandra Query Language 26 The resulting table in Cassandra is this: id title artist album data a3e64f8f… Hazim Ra3d Tarkan Spacetoon g617Dd23… Al Kanas
  • 27. MySQL Comparision: Cassandra MySQL Average Write 0.12 ms ~300 ms Average Read 15 ms ~350 ms 27 Statistics based on 50 GB Data Stats provided by Authors using Facebook data.
  • 29. The Data Model How the Database is Organized ? 29
  • 30. Data Model Cluster: Cassandra database is distributed over several machines that operate together. The outermost container is known as the Cluster. For failure handling, every node contains a replica, and in case of a failure, the replica takes charge. Cassandra arranges the nodes in a cluster, in a ring format, and assigns data to them. 30
  • 31. Data Model Keyspace Outermost container for data (one or more column families), like database in RDBMS. Column family Contains Super columns or Columns (but not both). Column Basic data structures with: key, value, timestamp 31
  • 34. Examples Using CQL The Following Slides will demonstrate different cases with different CQL interfaces like DDL, DML etc.. 34 User • Id • Name • Phone • Age Emails • Id • email
  • 35. 35 • Type • Keyspace , Table • Index , Trigger DROP • Type • Keyspace , Table • Index , Trigger CREATE • Type • Keyspace , Table • Index , Trigger ALTER Same as SQL, but with keyspaces and types option added. Interface DDL
  • 36. Interface DML 36 SELECT INSERT UPDATE DELETE DML The DML Interface is the Same With Normal SQL DML
  • 37. Interface DCL 37 VIEW LIST USERS LIST PERMISSION PERMISSION GRANT REVOKE USER CREATE DROP ALTER Create users (Roles), give them permission, and start using them.
  • 39. Metadata & Logging How to see metadata and make logging in Cassandra database ? 39
  • 40. Metadata Using Describe 40 Describe keyspace name Describe table keyspace__name .table_name Describe keyspaces, tables, schema keyspace Table Others
  • 41. Metadata Keyspace Query the defined key spaces using the SELECT statement. 41 SELECT * FROM system________schema._keyspaces keyspace__name durable__writes replication test True {'class': 'org.apache'}…. …… …… ……
  • 42. Metadata Tables Getting information about tables in the test keyspace. 42 SELECT * FROM system__schema.tables WHERE keyspace_name = test'; keyspace__name table__name ……. test users …….. …… …… ……
  • 43. Metadata Columns Getting information about columns in the users tables. 43 SELECT * FROM system_schema.columns WHERE keyspace__name = test' AND table_name = 'users'; table__name column___name kind type ……. users age regular int …….. …… …… …… …… ……
  • 44. Logging with System.log To see what is happening in the database, you can use the system.log file in the Cassandra home to directory to track creational query. 44 {CASSANDRA HOME}/utils/cassandra.logdir_IS_UNDEFINED/ {CASSANDRA HOME}/utils/cassandra.logdir_IS_UNDEFINED/ Here is an Example
  • 45. Logging with System.log 45 INFO [main] 2018-11-08 23:48:36,960 MigrationManager.java:302 - Create new Keyspace: KeyspaceMetadata {name=system_traces, params=KeyspaceParams {durable_writes=true, replication=ReplicationParams {class=org.apache.cassandra.locator.SimpleStrategy, replication_factor=2 } Here is an Example
  • 46. Logging with Tracing 46 TRACING [ ON | OFF] It’s an option to activate in the Cassandra database The result will be on different keyspace called system__traces. In a table called events USE system_traces; SELECT * FROM events;
  • 47. Logging with Tracing 47 INSERT INTO product(id , name) VALUES (UUID(), 'Hello'); Example: Execute CQL3 query Parsing insert into product(id , name) values(UUID(), 'Hello'); Preparing statement …… Result:
  • 48. Debate Strength and weakness of Cassandra. 4
  • 49. Strengths (1) ● Linear scale performance The ability to add nodes without failures leads to predictable increases In performance ● Supports multiple languages Python, C#/.NET, C++, Ruby, Java, Go, and many more… ● Operational and developmental simplicity There are no complex software tiers to be managed, so administration duties are greatly simplified. 49
  • 50. Strengths (2) ● Ability to deploy across data centers Cassandra can be deployed across multiple, geographically dispersed data centers ● Cloud availability Installations in cloud environments ● Peer to peer architecture Cassandra follows a peer-to-peer architecture, instead of master-slave architecture 50
  • 51. Strengths (3) ● Flexible data model Supports modern data types with fast writes and reads ● Fault tolerance Nodes that fail can easily be restored or replaced ● High Performance Cassandra has demonstrated brilliant performance under large sets of data 51
  • 52. Strengths (4) ● Schema-free/Schema-less In Cassandra, columns can be created at your will within the rows. Cassandra data model is also famously known as a schema-optional data model ● AP-CAP Cassandra is typically classified as an AP system, meaning that availability and partition tolerance are generally considered to be more important than consistency in Cassandra 52
  • 53. Weaknesses (1) Use Cases where is better to avoid using Cassandra ● If there are too many joins required to retrieve the data ● To store configuration data ● During compaction, things slow down and throughput degrades ● Basic things like aggregation operators are not supported ● Range queries on partition key are not supported 53
  • 54. Weaknesses (2) Use Cases where is better to avoid using Cassandra ● If there are transactional data which require 100% consistency ● Cassandra can update and delete data but it is not designed to do so 54