SlideShare uma empresa Scribd logo
1 de 55
Baixar para ler offline
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?

Mais conteúdo relacionado

Mais procurados

Cassandra an overview
Cassandra an overviewCassandra an overview
Cassandra an overviewPritamKathar
 
Intro to cassandra
Intro to cassandraIntro to cassandra
Intro to cassandraAaron Ploetz
 
NOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQLNOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQLRamakant Soni
 
Introduction to Cassandra Architecture
Introduction to Cassandra ArchitectureIntroduction to Cassandra Architecture
Introduction to Cassandra Architecturenickmbailey
 
Introduction to Cassandra Basics
Introduction to Cassandra BasicsIntroduction to Cassandra Basics
Introduction to Cassandra Basicsnickmbailey
 
introduction to NOSQL Database
introduction to NOSQL Databaseintroduction to NOSQL Database
introduction to NOSQL Databasenehabsairam
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & FeaturesDataStax Academy
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introductionPooyan Mehrparvar
 
What is NoSQL and CAP Theorem
What is NoSQL and CAP TheoremWhat is NoSQL and CAP Theorem
What is NoSQL and CAP TheoremRahul Jain
 
How netflix manages petabyte scale apache cassandra in the cloud
How netflix manages petabyte scale apache cassandra in the cloudHow netflix manages petabyte scale apache cassandra in the cloud
How netflix manages petabyte scale apache cassandra in the cloudVinay Kumar Chella
 
Cassandra vs. ScyllaDB: Evolutionary Differences
Cassandra vs. ScyllaDB: Evolutionary DifferencesCassandra vs. ScyllaDB: Evolutionary Differences
Cassandra vs. ScyllaDB: Evolutionary DifferencesScyllaDB
 
Introduction to Apache Cassandra
Introduction to Apache Cassandra Introduction to Apache Cassandra
Introduction to Apache Cassandra Knoldus Inc.
 
Appache Cassandra
Appache Cassandra  Appache Cassandra
Appache Cassandra nehabsairam
 
NoSQL Databases
NoSQL DatabasesNoSQL Databases
NoSQL DatabasesBADR
 

Mais procurados (20)

NoSQL databases
NoSQL databasesNoSQL databases
NoSQL databases
 
Cassandra an overview
Cassandra an overviewCassandra an overview
Cassandra an overview
 
Intro to cassandra
Intro to cassandraIntro to cassandra
Intro to cassandra
 
NOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQLNOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQL
 
Apache Spark Architecture
Apache Spark ArchitectureApache Spark Architecture
Apache Spark Architecture
 
Intro to HBase
Intro to HBaseIntro to HBase
Intro to HBase
 
NoSQL databases
NoSQL databasesNoSQL databases
NoSQL databases
 
Introduction to Cassandra Architecture
Introduction to Cassandra ArchitectureIntroduction to Cassandra Architecture
Introduction to Cassandra Architecture
 
Introduction to Cassandra Basics
Introduction to Cassandra BasicsIntroduction to Cassandra Basics
Introduction to Cassandra Basics
 
introduction to NOSQL Database
introduction to NOSQL Databaseintroduction to NOSQL Database
introduction to NOSQL Database
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & Features
 
Cassandra NoSQL Tutorial
Cassandra NoSQL TutorialCassandra NoSQL Tutorial
Cassandra NoSQL Tutorial
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introduction
 
What is NoSQL and CAP Theorem
What is NoSQL and CAP TheoremWhat is NoSQL and CAP Theorem
What is NoSQL and CAP Theorem
 
How netflix manages petabyte scale apache cassandra in the cloud
How netflix manages petabyte scale apache cassandra in the cloudHow netflix manages petabyte scale apache cassandra in the cloud
How netflix manages petabyte scale apache cassandra in the cloud
 
Cassandra vs. ScyllaDB: Evolutionary Differences
Cassandra vs. ScyllaDB: Evolutionary DifferencesCassandra vs. ScyllaDB: Evolutionary Differences
Cassandra vs. ScyllaDB: Evolutionary Differences
 
Introduction to Apache Cassandra
Introduction to Apache Cassandra Introduction to Apache Cassandra
Introduction to Apache Cassandra
 
Appache Cassandra
Appache Cassandra  Appache Cassandra
Appache Cassandra
 
Cassandra 101
Cassandra 101Cassandra 101
Cassandra 101
 
NoSQL Databases
NoSQL DatabasesNoSQL Databases
NoSQL Databases
 

Semelhante a 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
 
Migrating Oracle database to Cassandra
Migrating Oracle database to CassandraMigrating Oracle database to Cassandra
Migrating Oracle database to CassandraUmair Mansoob
 

Semelhante a 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 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
 
Migrating Oracle database to Cassandra
Migrating Oracle database to CassandraMigrating Oracle database to Cassandra
Migrating Oracle database to Cassandra
 

Último

Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...amitlee9823
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...amitlee9823
 
ALSO dropshipping via API with DroFx.pptx
ALSO dropshipping via API with DroFx.pptxALSO dropshipping via API with DroFx.pptx
ALSO dropshipping via API with DroFx.pptxolyaivanovalion
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Valters Lauzums
 
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
 
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...amitlee9823
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...amitlee9823
 
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
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightDelhi Call girls
 
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
 
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
 
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
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramMoniSankarHazra
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...amitlee9823
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...amitlee9823
 
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...amitlee9823
 

Último (20)

Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
ALSO dropshipping via API with DroFx.pptx
ALSO dropshipping via API with DroFx.pptxALSO dropshipping via API with DroFx.pptx
ALSO dropshipping via API with DroFx.pptx
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
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
 
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
 
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...
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
 
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
 
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
 
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...
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics Program
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
 
(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
 
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
 

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