Advantages of Cassandra's masterless architecture
Transcript of Advantages of Cassandra's masterless architecture
Advantages of Cassandra’s masterless architecture
Duy Lam @ RDKMS TechCon 2015
Masterless Architecture
Cautions
Introduction
An Apache Software
Foundation project
Built on Java
DataStax
Masterless Architecture
Cautions
Masterless Architecture
Peer-to-peer Database
Automatic Data
Distribution
Built-in Replication
Masterless Architecture
Cassandra clusterBackground service
Webservice
Application
Peer-to-peer Database
Automatic Data Distribution Built-in Replication
No SPOF
A node
Masterless ArchitecturePeer-to-peer
DatabaseAutomatic Data
Distribution Built-in Replication
partition id name
usa_1994 ae12f… The Shawshank Redemption
usa_1994 bb2ac… Forrest Gump
skorea_2002 31dcc… The Way Home
vn_2015 890af… Jackpot
2usa_1994 ae… The Sha..
usa_1994 bb… Forrest..
1 skorea_2002 31… The Way …
3 vn_2015 89… Jackpot
Cassandra cluster
CREATE TABLE movie ( partition text , id uuid, name text)
Masterless ArchitecturePeer-to-peer
DatabaseAutomatic Data
Distribution Built-in Replication
partition id name
(A)usa_1994 ae12f… The Shawshank Redemption
usa_1994 bb2ac… Forrest Gump
(B) skorea_2002 31dcc… The Way Home
(C) vn_2015 890af… Jackpot
2
1
3
Cassandra cluster
CREATE TABLE movie ( partition text , id uuid, name text)
(B) (A’) (C’)
(A) (B’) (C’)
(C) (A’) (B’)
The Advantages
Peer-to-peer Database
Automatic Data Distribution
Built-in Replication ?
The Advantages
Peer-to-peer Database
Automatic Data Distribution
Built-in Replication
HighAvailability
FaultToleranceScalability
Demo now
Fault Tolerance ScalabilityHigh
Availability
Masterless Architecture
Cautions
Cautions
Cassandra is from NoSQL familySo
?
Cautions
Cassandra is from NoSQL familySo Different data modeling (try to google “nosql
data modeling”) No Atomicity for multiple tables (or
“documents”) no transaction Not good at complex query (group by, having,
like, >=, etc.)
CautionsCREATE TABLE movie ( partition text, id uuid, name text, released_year int, country text, PRIMARY KEY (partition, id))
Limited query capability in Cassandra
SELECT * FROM movie WHERE release_year < 2000name LIKE “Star Trek”name IN ( “Tangled”, “Frozen” )name = “Inside Out” and year = 2015length = nulllength = 120 OR release_year = 2015
UPDATE movie SET length=95 WHERE partition = “vn” AND id = 10INSERT INTO movie(partition, id, length) VALUES(“usa”, 15, 120)
(1)
(2)
(3)
(4)
(5)
(6)
CautionsCREATE TABLE movie ( partition text, id uuid, name text, released_year int, country text, PRIMARY KEY (partition, id))
Limited query capability in Cassandra
SELECT * FROM movie WHERE release_year < 2000name LIKE “Star Trek”name IN ( “Tangled”, “Frozen” )name = “Inside Out” and year = 2015length = nulllength = 120 OR release_year = 2015
UPDATE movie SET length=95 WHERE partition = “vn” AND id = 10INSERT INTO movie(partition, id, length) VALUES(“usa”, 15, 120)
(1)
(2)
(3)
(4)
(5)
(6)
References
DataStax Cassandra Tutorialshttps://www.youtube.com/playlist?list=PL3E5AC388940EEC0A
(thanks to Provision feature) Launch Cassandra clustering system athttp://bit.ly/kms-techcon2015-cassandra-demo
Take Away
Masterless Architecture– Peer-to-peer Database– Automatic Data Distribution– Built-in Replication
Cautions– Cassandra is from NoSQL family– Limited query capability
THANKS YOU