Introduction à Cassandra
-
Upload
gerald-quintana -
Category
Technology
-
view
82 -
download
2
Transcript of Introduction à Cassandra
Big DataBig data is highvolume, highvelocity and highvariety informationassets that demand costeffective, innovative forms of informationprocessing for enhanced insight and decision making.
Gartner
3 / 35
SQL or NoSQL?Not using the relational model (nor the SQL language).Open source.Designed to run on large clustersBased on the needs of 21st century web propertiesNo schema, allowing fields to be added to any record without controls
http://martinfowler.com/bliki/NosqlDefinition.html
5 / 35
ACID
AtomicityCohérenceIsolationDurability
BASE
Basically AvailableSoft stateEventual consistency
ACID ou BASE?
7 / 35
Cassandra en résuméDistribuéeMasterless: pas de SPOFScalabilité linéaireTolérance aux pannes: 100% uptimePerformancesConsistance réglableMultidatacenterSimplicité opérationnelle
10 / 35
Scalabilité linéaire
http://techblog.netflix.com/2011/11/benchmarkingcassandrascalabilityon.html
16 / 35
Pour l'écritureAppend only + compactionPas de disk seek
Pour la lectureRéplication & Load balancingModélisation adaptée → AccèsdirectCaches par table
Performances
26 / 35
Simplicité opérationnelleInstallation
Linux, Java, Python, NTPPackaging: .tar, .rpm, .deb, .exe23 fichiers de configuration1 seul processus1 seul type de noeud
Monitoringnodetool, JMX, OpsCenter
27 / 35
CQLCREATE TABLE utilisateur( id_utilisateur UUID, login VARCHAR, date_naissance TIMESTAMP, roles SET<VARCHAR>, PRIMARY KEY (id_utilisateur));
INSERT INTO utilisateur(id_utilisateur, login, date_naissance, roles) VALUES ('abc123...', 'jdoe', '1978-04-06',{'blogger','journaliste'});
SELECT * FROM utilisateur WHERE id_utilisateur='abc123...';
29 / 35
CQL Grandes lignesCREATE TABLE message( id_utilisateur UUID, id_message TIMEUUID, message VARCHAR, PRIMARY KEY (id_utilisateur, id_message));
INSERT INTO message(id_utilisateur, id_message) VALUES ('abc123...', now(),'Vive Cassandra');
SELECT * FROM utilisateur WHERE id_utilisateur='abc123...';SELECT message FROM utilisateur WHERE id_utilisateur='abc123...' AND id_message='cde456...';
31 / 35
Modèle orienté colonne
Table utilisateur
Table message
Map<RowKey, SortedMap<ColumnKey, ColumnValue>>
32 / 35
ModélisationDénormaliser!Besoin → Requête → TableAdapter les données aux requêtes (pas l'inverse)
33 / 35
Driver
Load balancing, tolérance aux pannes, découverteSynchrone ou asynchrone (réactive programming)Librairies Java:
ObjectMapper, Achilles, Spring Data Cassandra...Cassandra Unit, Stubbed Cassandra
34 / 35