SlideShare une entreprise Scribd logo
1  sur  55
Télécharger pour lire hors ligne
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?

Contenu connexe

Tendances

Cassandra an overview
Cassandra an overviewCassandra an overview
Cassandra an overviewPritamKathar
 
Introduction to Apache Cassandra
Introduction to Apache CassandraIntroduction to Apache Cassandra
Introduction to Apache CassandraRobert Stupp
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introductionPooyan Mehrparvar
 
Introduction to Cassandra Architecture
Introduction to Cassandra ArchitectureIntroduction to Cassandra Architecture
Introduction to Cassandra Architecturenickmbailey
 
Understanding Data Partitioning and Replication in Apache Cassandra
Understanding Data Partitioning and Replication in Apache CassandraUnderstanding Data Partitioning and Replication in Apache Cassandra
Understanding Data Partitioning and Replication in Apache CassandraDataStax
 
Introduction to Cassandra Basics
Introduction to Cassandra BasicsIntroduction to Cassandra Basics
Introduction to Cassandra Basicsnickmbailey
 
Hadoop Architecture and HDFS
Hadoop Architecture and HDFSHadoop Architecture and HDFS
Hadoop Architecture and HDFSEdureka!
 
Introduction to Apache Cassandra
Introduction to Apache Cassandra Introduction to Apache Cassandra
Introduction to Apache Cassandra Knoldus Inc.
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcachedJurriaan Persyn
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBMike Dirolf
 
Streaming data for real time analysis
Streaming data for real time analysisStreaming data for real time analysis
Streaming data for real time analysisAmazon Web Services
 
What Is Apache Spark? | Introduction To Apache Spark | Apache Spark Tutorial ...
What Is Apache Spark? | Introduction To Apache Spark | Apache Spark Tutorial ...What Is Apache Spark? | Introduction To Apache Spark | Apache Spark Tutorial ...
What Is Apache Spark? | Introduction To Apache Spark | Apache Spark Tutorial ...Simplilearn
 
Processing Large Datasets for ADAS Applications using Apache Spark
Processing Large Datasets for ADAS Applications using Apache SparkProcessing Large Datasets for ADAS Applications using Apache Spark
Processing Large Datasets for ADAS Applications using Apache SparkDatabricks
 

Tendances (20)

Cassandra an overview
Cassandra an overviewCassandra an overview
Cassandra an overview
 
Cassandra
CassandraCassandra
Cassandra
 
Introduction to Apache Cassandra
Introduction to Apache CassandraIntroduction to Apache Cassandra
Introduction to Apache Cassandra
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introduction
 
Introduction to Cassandra Architecture
Introduction to Cassandra ArchitectureIntroduction to Cassandra Architecture
Introduction to Cassandra Architecture
 
Understanding Data Partitioning and Replication in Apache Cassandra
Understanding Data Partitioning and Replication in Apache CassandraUnderstanding Data Partitioning and Replication in Apache Cassandra
Understanding Data Partitioning and Replication in Apache Cassandra
 
Apache HBase™
Apache HBase™Apache HBase™
Apache HBase™
 
Introduction to Cassandra Basics
Introduction to Cassandra BasicsIntroduction to Cassandra Basics
Introduction to Cassandra Basics
 
Hadoop Architecture and HDFS
Hadoop Architecture and HDFSHadoop Architecture and HDFS
Hadoop Architecture and HDFS
 
Introduction to Apache Cassandra
Introduction to Apache Cassandra Introduction to Apache Cassandra
Introduction to Apache Cassandra
 
MongoDB
MongoDBMongoDB
MongoDB
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
 
Intro to Apache Spark
Intro to Apache SparkIntro to Apache Spark
Intro to Apache Spark
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Streaming data for real time analysis
Streaming data for real time analysisStreaming data for real time analysis
Streaming data for real time analysis
 
Intro to HBase
Intro to HBaseIntro to HBase
Intro to HBase
 
Introduction to Data Engineering
Introduction to Data EngineeringIntroduction to Data Engineering
Introduction to Data Engineering
 
What Is Apache Spark? | Introduction To Apache Spark | Apache Spark Tutorial ...
What Is Apache Spark? | Introduction To Apache Spark | Apache Spark Tutorial ...What Is Apache Spark? | Introduction To Apache Spark | Apache Spark Tutorial ...
What Is Apache Spark? | Introduction To Apache Spark | Apache Spark Tutorial ...
 
Processing Large Datasets for ADAS Applications using Apache Spark
Processing Large Datasets for ADAS Applications using Apache SparkProcessing Large Datasets for ADAS Applications using Apache Spark
Processing Large Datasets for ADAS Applications using Apache Spark
 
NOSQL vs SQL
NOSQL vs SQLNOSQL vs SQL
NOSQL vs SQL
 

Similaire à Cassandra Database

Appache Cassandra
Appache Cassandra  Appache Cassandra
Appache Cassandra nehabsairam
 
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
 

Similaire à Cassandra Database (20)

Appache Cassandra
Appache Cassandra  Appache Cassandra
Appache Cassandra
 
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 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
 

Dernier

Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...amitlee9823
 
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
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxMohammedJunaid861692
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxolyaivanovalion
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Researchmichael115558
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxJohnnyPlasten
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfadriantubila
 
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
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceDelhi Call girls
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFxolyaivanovalion
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...SUHANI PANDEY
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Delhi Call girls
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...shivangimorya083
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxolyaivanovalion
 
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
 

Dernier (20)

Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
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
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptx
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
 
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
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFx
 
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
 

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