SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
CASSANDRA-JAVA-DRIVER
Vers Cassandra 1.2 et au delà
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
Sommaire

Cassandra

CQL 3

Binary Protocol

Java Driver

Modes de Requêtage

Métriques

Policies
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
AGILITE
CASSANDRA
Base de données NoSQL orientée colonne

Extrêmement rapide

Pas de SPOF

Écrite en Java

...
2008
Facebook
2013
1.2
2009 2010 2011 2012
1.11.00.8
Apache
top level 0.8
Apache
incubator
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
CASSANDRA JAVA DRIVER
DATASTAX CASSANDRA JAVA DRIVER
CQL 3 + CQL Binary Protocol
Version 1.0.0
Release Mai 2013
Compatible avec Cassandra 1.2+
Apache License Version 2.0
Développé par les équipes de Datastax
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
AGILITE
CQL 3 - CQL
CQL : C  assandra Query Language
CQL 3 ~  = SQL
Même syntaxe sans agrégation (JOIN, GROUP BY, …)
Changement de philosophie avec CQL 3 :   
→ Nécessite un schéma ! 
CREATE TABLE Users (KEY text PRIMARY KEY, NAME text)
INSERT INTO Users(KEY, NAME) VALUES ('1','Buzz') SELECT * FROM Users
UPDATE Users SET NAME='Woody' WHERE KEY='1'
ALTER TABLE Users ADD AGE text
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
AGILITE
CQL 3 - SCHEMA
ippon@ippon:~$ cqlsh -2 -k ippevent
[cqlsh 3.0.2 | Cassandra 0.0.0 | CQL spec 2.0.0 | Thrift protocol 19.36.0]
cqlsh:ippevent> CREATE TABLE person (KEY text PRIMARY KEY, NAME text);
cqlsh:ippevent> INSERT INTO person(KEY, NAME, AGE) VALUES ('1','buzz',30);
cqlsh:ippevent> SELECT * FROM person;
KEY | AGE | NAME
-----+-----+------
1 | 30 | buzz
ippon@ippon:~$ cqlsh -3 -k ippevent
[cqlsh 3.0.2 | Cassandra 1.2.5 | CQL spec 3.0.0 | Thrift protocol 19.36.0]
cqlsh:ippevent> CREATE TABLE person (KEY text PRIMARY KEY, NAME text);
cqlsh:ippevent> INSERT INTO person(KEY, NAME, AGE) VALUES ('1','buzz',30);
Bad Request: Unknown identifier age
CLQ 2
CLQ 3
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
AGILITE
CQL 3 - UPSERT
Cependant l'UPSERT reste possible
cqlsh:ippevent> SELECT * FROM Mutations;
cqlsh:ippevent> UPDATE Mutations SET A='value from UPDATE'
WHERE KEY='1';
cqlsh:ippevent> SELECT * FROM Mutations;
key | a | b
-----+-------------------+------
1 | value from UPDATE | null
cqlsh:ippevent> INSERT INTO Mutations(KEY,B)
VALUES('1','value from INSERT');
cqlsh:ippevent> SELECT * FROM Mutations;
key | a | b
-----+-------------------+-------------------
1 | value from UPDATE | value from INSERT
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
CQL 3 – Super Column
Abandon des Super Columns

Colonne dont la valeur est des colonnes
→ Préférer désormais l'utilisation de
clustering keys
buzz AGE ADRESSE
32 NUMERO RUE VILLE
90 Baudin Levallois
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
CQL 3 – Modélisation (Wide Rows)
Wide Rows
Cassandra peut stocker plus de 2M de colonnes par
clef.
Exemple : 
→ Comment faire avec CQL 3 ? 
buzz 133829 133950 134022 142109
Star command
...
Vers l'infini Où est Zurg ? Space
command ...
woody 133983 134802
J'ai un
serpent ...
Qui a
empoisonné ...
KEY COLUMNS ...
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
CQL 3 – Modélisation (Wide Rows)
buzz 133829-dialog 133950-dialog 134022-dialog 142109-dialog
Star command ... Vers l'infini Où est Zurg ? Space command ...
woody 133983-dialog 134802-dialog
J'ai un serpent ... Qui a empoisonné ...
CREATE TABLE DIALOG (
username VARCHAR,
said_at TIMESTAMP,
dialog VARCHAR,
PRIMARY KEY (username, said_at)
)
username said_at dialog
buzz 133829 Star command ...
buzz 133950 Vers l'infini ...
...
woody 133983 J'ai un serpent ...
...
Représentation Logique
Représentation Physique
Partition key Clustering key
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
AGILITE
CQL 3 - Performances
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
AGILITE
CQL 3 - Performances
Attention : performance des SELECT * 
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
AGILITE
CQL Binary Protocol
CQL Binary Protocol remplaçant de Thrift
Thrift : rapide et multi-language 
Pourquoi changer ? RPC seulement. 
CQL Binary Protocol ouvre la porte au
streaming (curseurs), aux notifications
techniques, …
Mais Thrift reste maintenu
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
AGILITE
CQL Binary Protocol

Nouveau port (9042 par défaut)

Actif par défaut Cassandra 1.2.5+

Peut cohabiter avec l'interface Thrift
$CASSANDRA_HOME/conf/cassandra.yaml
# Whether to start the native transport server.
# Please note that the address on which the native transport is bound is the
# same as the rpc_address. The port however is different and specified below.
start_native_transport: true
# port for the CQL native transport to listen for clients on
native_transport_port: 9042
# Whether to start the thrift rpc server.
start_rpc: true
# port for Thrift to listen for clients on
rpc_port: 9160
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
AGILITE
Java Driver
Java Driver
Fonctionnalités

Query

Query Builder

Prepared Statements

Exécution asynchrone

Métriques

Politiques
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
AGILITE
Java Driver - QueryBuilder
QueryBuilder : 

Construction de requêtes typées

Fluent API
Opérations supportées

SELECT

UPDATE

INSERT

DELETE

BATCH
Pas encore d’opérations de DDL (prévu en 1.1.0)
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
Java Driver – Policies
ReconnectionPolicy

ConstantReconnectionPolicy // ré-éssai à intervall régulier

ExponentialReconnectionPolicy
LoadBalancingPolicy

DCAwareRoundRobinPolicy // load balance au sein d'un DC

RoundRobinPolicy

TokenAwarePolicy // load balance sur les nœuds qui ont la data
RetryPolicy

DowngradingConsistencyPolicy

LoggingRetryPolicy
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
AGILITE
CONCLUSION
Java Driver utilise un nouveau socle tourné vers les
futures releases de Cassandra

CQL 3

Adoption par utilisateurs SQL facilitée

Représentation logique de stockages spécifiques

CQL Binary Protocol

Taillé pour la forte volumétrie

Permettra d'accueillir de nouvelles fonctionnalités (ex : 
curseurs)
1ère implémentation de ces 2 socles
API très agréable à utiliser
Très configurable/extensible
www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr
Liens
C* Summit 2013 : 

http://planetcassandra.org/Learn/CassandraSummit
NYC* 2013 - New Cassandra Drivers in Depth«   »
Michael Figuière
Documentation : 

http://www.datastax.com/doc-source/developer/java-driver/
Benchs

https://github.com/brianfrankcooper/YCSB

https://github.com/vberetti/YCSB
Cassandra Ippevent 20 Juin 2013

Mais conteúdo relacionado

Mais procurados

Travaux pratiques configuration du routage entre réseaux locaux virtuels
Travaux pratiques   configuration du routage entre réseaux locaux virtuelsTravaux pratiques   configuration du routage entre réseaux locaux virtuels
Travaux pratiques configuration du routage entre réseaux locaux virtuelsMohamed Keita
 
VTP(Virtual Trunking Protocol)
VTP(Virtual Trunking Protocol)VTP(Virtual Trunking Protocol)
VTP(Virtual Trunking Protocol)Sirine Ibrahim
 
EIGRP - Fonctionnalités avancées de l’EIGRP
EIGRP -  Fonctionnalités avancées de l’EIGRPEIGRP -  Fonctionnalités avancées de l’EIGRP
EIGRP - Fonctionnalités avancées de l’EIGRPmdyabi
 
EIGRP - Configuration
EIGRP - ConfigurationEIGRP - Configuration
EIGRP - Configurationmdyabi
 
EIGRP - Résumé EIGRP
EIGRP - Résumé EIGRPEIGRP - Résumé EIGRP
EIGRP - Résumé EIGRPmdyabi
 
Préparation de 2015 !!
Préparation de 2015 !!Préparation de 2015 !!
Préparation de 2015 !!Ahmed X-boy
 
Présentation etherchannel
Présentation etherchannelPrésentation etherchannel
Présentation etherchannelLechoco Kado
 
3 switchport securité
3 switchport securité3 switchport securité
3 switchport securitémedalaa
 
Composants et fonctionnement d'un Routeur Cisco
Composants et fonctionnement d'un Routeur CiscoComposants et fonctionnement d'un Routeur Cisco
Composants et fonctionnement d'un Routeur CiscoDJENNA AMIR
 
Authentification des protocoles de routage
Authentification des protocoles de routageAuthentification des protocoles de routage
Authentification des protocoles de routageThomas Moegli
 
Redondance de routeur (hsrp, vrrp, glbp)
Redondance de routeur (hsrp, vrrp, glbp)Redondance de routeur (hsrp, vrrp, glbp)
Redondance de routeur (hsrp, vrrp, glbp)EL AMRI El Hassan
 

Mais procurados (20)

Travaux pratiques configuration du routage entre réseaux locaux virtuels
Travaux pratiques   configuration du routage entre réseaux locaux virtuelsTravaux pratiques   configuration du routage entre réseaux locaux virtuels
Travaux pratiques configuration du routage entre réseaux locaux virtuels
 
Redondance
RedondanceRedondance
Redondance
 
VTP(Virtual Trunking Protocol)
VTP(Virtual Trunking Protocol)VTP(Virtual Trunking Protocol)
VTP(Virtual Trunking Protocol)
 
CISCO HSRP VRRP GLBP
CISCO HSRP VRRP GLBPCISCO HSRP VRRP GLBP
CISCO HSRP VRRP GLBP
 
EIGRP - Fonctionnalités avancées de l’EIGRP
EIGRP -  Fonctionnalités avancées de l’EIGRPEIGRP -  Fonctionnalités avancées de l’EIGRP
EIGRP - Fonctionnalités avancées de l’EIGRP
 
Cours eigrp
Cours eigrpCours eigrp
Cours eigrp
 
EIGRP - Configuration
EIGRP - ConfigurationEIGRP - Configuration
EIGRP - Configuration
 
EtherChannel
EtherChannelEtherChannel
EtherChannel
 
Protocole OSPF
Protocole OSPFProtocole OSPF
Protocole OSPF
 
EIGRP - Résumé EIGRP
EIGRP - Résumé EIGRPEIGRP - Résumé EIGRP
EIGRP - Résumé EIGRP
 
Acl cisco
Acl ciscoAcl cisco
Acl cisco
 
Protocole IKE/IPsec
Protocole IKE/IPsecProtocole IKE/IPsec
Protocole IKE/IPsec
 
Préparation de 2015 !!
Préparation de 2015 !!Préparation de 2015 !!
Préparation de 2015 !!
 
Présentation etherchannel
Présentation etherchannelPrésentation etherchannel
Présentation etherchannel
 
3 switchport securité
3 switchport securité3 switchport securité
3 switchport securité
 
Ccna4
Ccna4Ccna4
Ccna4
 
Protocole EIGRP
Protocole EIGRPProtocole EIGRP
Protocole EIGRP
 
Composants et fonctionnement d'un Routeur Cisco
Composants et fonctionnement d'un Routeur CiscoComposants et fonctionnement d'un Routeur Cisco
Composants et fonctionnement d'un Routeur Cisco
 
Authentification des protocoles de routage
Authentification des protocoles de routageAuthentification des protocoles de routage
Authentification des protocoles de routage
 
Redondance de routeur (hsrp, vrrp, glbp)
Redondance de routeur (hsrp, vrrp, glbp)Redondance de routeur (hsrp, vrrp, glbp)
Redondance de routeur (hsrp, vrrp, glbp)
 

Destaque

Social media for us five things to do now for call
Social media for us   five things to do now for callSocial media for us   five things to do now for call
Social media for us five things to do now for callDan Cohen
 
NISM Update August 2011
NISM Update August 2011NISM Update August 2011
NISM Update August 2011NISM
 
GTUG Nantes (Dec 2011) - BigTable et NoSQL
GTUG Nantes (Dec 2011) - BigTable et NoSQLGTUG Nantes (Dec 2011) - BigTable et NoSQL
GTUG Nantes (Dec 2011) - BigTable et NoSQLMichaël Figuière
 
Caso Braillard Peugeot
Caso Braillard PeugeotCaso Braillard Peugeot
Caso Braillard PeugeotIAB_PERU
 
Swdc google app_engine_for_business
Swdc google app_engine_for_businessSwdc google app_engine_for_business
Swdc google app_engine_for_businessPatrick Chanezon
 
Restlet et le multi-plateforme
Restlet et le multi-plateformeRestlet et le multi-plateforme
Restlet et le multi-plateformeJerome Louvel
 
CALPACT - Engaging Target Audiences march 15 2012
CALPACT - Engaging Target Audiences  march 15 2012CALPACT - Engaging Target Audiences  march 15 2012
CALPACT - Engaging Target Audiences march 15 2012Dan Cohen
 

Destaque (9)

Social media for us five things to do now for call
Social media for us   five things to do now for callSocial media for us   five things to do now for call
Social media for us five things to do now for call
 
NISM Update August 2011
NISM Update August 2011NISM Update August 2011
NISM Update August 2011
 
GTUG Nantes (Dec 2011) - BigTable et NoSQL
GTUG Nantes (Dec 2011) - BigTable et NoSQLGTUG Nantes (Dec 2011) - BigTable et NoSQL
GTUG Nantes (Dec 2011) - BigTable et NoSQL
 
Whytime
WhytimeWhytime
Whytime
 
OhMyGuest
OhMyGuestOhMyGuest
OhMyGuest
 
Caso Braillard Peugeot
Caso Braillard PeugeotCaso Braillard Peugeot
Caso Braillard Peugeot
 
Swdc google app_engine_for_business
Swdc google app_engine_for_businessSwdc google app_engine_for_business
Swdc google app_engine_for_business
 
Restlet et le multi-plateforme
Restlet et le multi-plateformeRestlet et le multi-plateforme
Restlet et le multi-plateforme
 
CALPACT - Engaging Target Audiences march 15 2012
CALPACT - Engaging Target Audiences  march 15 2012CALPACT - Engaging Target Audiences  march 15 2012
CALPACT - Engaging Target Audiences march 15 2012
 

Semelhante a Cassandra Ippevent 20 Juin 2013

Ops@viadeo : Puppet & Co... 6 mois après par Xavier Krantz
Ops@viadeo : Puppet & Co... 6 mois après par Xavier KrantzOps@viadeo : Puppet & Co... 6 mois après par Xavier Krantz
Ops@viadeo : Puppet & Co... 6 mois après par Xavier KrantzOlivier DASINI
 
Firewalls
FirewallsFirewalls
Firewallsc0r3war
 
Les commandes CISCO (routeur)
Les commandes CISCO (routeur)Les commandes CISCO (routeur)
Les commandes CISCO (routeur)EL AMRI El Hassan
 
Alphorm.com Formation CCNP ENCOR 350-401 (2of8) : Routing
Alphorm.com Formation CCNP ENCOR 350-401 (2of8) : RoutingAlphorm.com Formation CCNP ENCOR 350-401 (2of8) : Routing
Alphorm.com Formation CCNP ENCOR 350-401 (2of8) : RoutingAlphorm
 
Deep Dive: Virtual Private Cloud
Deep Dive: Virtual Private CloudDeep Dive: Virtual Private Cloud
Deep Dive: Virtual Private CloudJulien SIMON
 
Alphorm.com Formation CCNP ENCOR 350-401 (5/8) : Architecture
Alphorm.com Formation CCNP ENCOR 350-401 (5/8) : ArchitectureAlphorm.com Formation CCNP ENCOR 350-401 (5/8) : Architecture
Alphorm.com Formation CCNP ENCOR 350-401 (5/8) : ArchitectureAlphorm
 
Event sourcing avec Kafka, UPEC
Event sourcing avec Kafka, UPECEvent sourcing avec Kafka, UPEC
Event sourcing avec Kafka, UPECSylia Baraka
 
Paris Scala User Group #43 - Spray (Magnet Pattern) + RxScala / ElasticSearch
Paris Scala User Group #43 - Spray (Magnet Pattern) + RxScala / ElasticSearchParis Scala User Group #43 - Spray (Magnet Pattern) + RxScala / ElasticSearch
Paris Scala User Group #43 - Spray (Magnet Pattern) + RxScala / ElasticSearchMourad DACHRAOUI
 
Orchestrating Docker in production - TIAD Camp Docker
Orchestrating Docker in production - TIAD Camp DockerOrchestrating Docker in production - TIAD Camp Docker
Orchestrating Docker in production - TIAD Camp DockerThe Incredible Automation Day
 
IPv6 training
IPv6 trainingIPv6 training
IPv6 trainingFred Bovy
 
Spark Streaming
Spark StreamingSpark Streaming
Spark StreamingPALO IT
 

Semelhante a Cassandra Ippevent 20 Juin 2013 (20)

Ops@viadeo : Puppet & Co... 6 mois après par Xavier Krantz
Ops@viadeo : Puppet & Co... 6 mois après par Xavier KrantzOps@viadeo : Puppet & Co... 6 mois après par Xavier Krantz
Ops@viadeo : Puppet & Co... 6 mois après par Xavier Krantz
 
Firewalls
FirewallsFirewalls
Firewalls
 
Démystifier la programmation avec LabVIEW FPGA
Démystifier la programmation avec LabVIEW FPGADémystifier la programmation avec LabVIEW FPGA
Démystifier la programmation avec LabVIEW FPGA
 
Les commandes CISCO (routeur)
Les commandes CISCO (routeur)Les commandes CISCO (routeur)
Les commandes CISCO (routeur)
 
Tout atm
Tout atmTout atm
Tout atm
 
Orchestration
OrchestrationOrchestration
Orchestration
 
Orchestration
OrchestrationOrchestration
Orchestration
 
Astuces cisco
Astuces ciscoAstuces cisco
Astuces cisco
 
Alphorm.com Formation CCNP ENCOR 350-401 (2of8) : Routing
Alphorm.com Formation CCNP ENCOR 350-401 (2of8) : RoutingAlphorm.com Formation CCNP ENCOR 350-401 (2of8) : Routing
Alphorm.com Formation CCNP ENCOR 350-401 (2of8) : Routing
 
CCNA 3.pdf
CCNA 3.pdfCCNA 3.pdf
CCNA 3.pdf
 
Deep Dive: Virtual Private Cloud
Deep Dive: Virtual Private CloudDeep Dive: Virtual Private Cloud
Deep Dive: Virtual Private Cloud
 
Alphorm.com Formation CCNP ENCOR 350-401 (5/8) : Architecture
Alphorm.com Formation CCNP ENCOR 350-401 (5/8) : ArchitectureAlphorm.com Formation CCNP ENCOR 350-401 (5/8) : Architecture
Alphorm.com Formation CCNP ENCOR 350-401 (5/8) : Architecture
 
Event sourcing avec Kafka, UPEC
Event sourcing avec Kafka, UPECEvent sourcing avec Kafka, UPEC
Event sourcing avec Kafka, UPEC
 
Tuto VP IPSEC Site-to-site
Tuto VP IPSEC Site-to-siteTuto VP IPSEC Site-to-site
Tuto VP IPSEC Site-to-site
 
Paris Scala User Group #43 - Spray (Magnet Pattern) + RxScala / ElasticSearch
Paris Scala User Group #43 - Spray (Magnet Pattern) + RxScala / ElasticSearchParis Scala User Group #43 - Spray (Magnet Pattern) + RxScala / ElasticSearch
Paris Scala User Group #43 - Spray (Magnet Pattern) + RxScala / ElasticSearch
 
Adsl cisco
Adsl ciscoAdsl cisco
Adsl cisco
 
Vpn
VpnVpn
Vpn
 
Orchestrating Docker in production - TIAD Camp Docker
Orchestrating Docker in production - TIAD Camp DockerOrchestrating Docker in production - TIAD Camp Docker
Orchestrating Docker in production - TIAD Camp Docker
 
IPv6 training
IPv6 trainingIPv6 training
IPv6 training
 
Spark Streaming
Spark StreamingSpark Streaming
Spark Streaming
 

Cassandra Ippevent 20 Juin 2013

  • 1. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr CASSANDRA-JAVA-DRIVER Vers Cassandra 1.2 et au delà
  • 2. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr Sommaire  Cassandra  CQL 3  Binary Protocol  Java Driver  Modes de Requêtage  Métriques  Policies
  • 3. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr AGILITE CASSANDRA Base de données NoSQL orientée colonne  Extrêmement rapide  Pas de SPOF  Écrite en Java  ... 2008 Facebook 2013 1.2 2009 2010 2011 2012 1.11.00.8 Apache top level 0.8 Apache incubator
  • 4. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr CASSANDRA JAVA DRIVER DATASTAX CASSANDRA JAVA DRIVER CQL 3 + CQL Binary Protocol Version 1.0.0 Release Mai 2013 Compatible avec Cassandra 1.2+ Apache License Version 2.0 Développé par les équipes de Datastax
  • 5. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr AGILITE CQL 3 - CQL CQL : C  assandra Query Language CQL 3 ~  = SQL Même syntaxe sans agrégation (JOIN, GROUP BY, …) Changement de philosophie avec CQL 3 :    → Nécessite un schéma !  CREATE TABLE Users (KEY text PRIMARY KEY, NAME text) INSERT INTO Users(KEY, NAME) VALUES ('1','Buzz') SELECT * FROM Users UPDATE Users SET NAME='Woody' WHERE KEY='1' ALTER TABLE Users ADD AGE text
  • 6. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr AGILITE CQL 3 - SCHEMA ippon@ippon:~$ cqlsh -2 -k ippevent [cqlsh 3.0.2 | Cassandra 0.0.0 | CQL spec 2.0.0 | Thrift protocol 19.36.0] cqlsh:ippevent> CREATE TABLE person (KEY text PRIMARY KEY, NAME text); cqlsh:ippevent> INSERT INTO person(KEY, NAME, AGE) VALUES ('1','buzz',30); cqlsh:ippevent> SELECT * FROM person; KEY | AGE | NAME -----+-----+------ 1 | 30 | buzz ippon@ippon:~$ cqlsh -3 -k ippevent [cqlsh 3.0.2 | Cassandra 1.2.5 | CQL spec 3.0.0 | Thrift protocol 19.36.0] cqlsh:ippevent> CREATE TABLE person (KEY text PRIMARY KEY, NAME text); cqlsh:ippevent> INSERT INTO person(KEY, NAME, AGE) VALUES ('1','buzz',30); Bad Request: Unknown identifier age CLQ 2 CLQ 3
  • 7. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr AGILITE CQL 3 - UPSERT Cependant l'UPSERT reste possible cqlsh:ippevent> SELECT * FROM Mutations; cqlsh:ippevent> UPDATE Mutations SET A='value from UPDATE' WHERE KEY='1'; cqlsh:ippevent> SELECT * FROM Mutations; key | a | b -----+-------------------+------ 1 | value from UPDATE | null cqlsh:ippevent> INSERT INTO Mutations(KEY,B) VALUES('1','value from INSERT'); cqlsh:ippevent> SELECT * FROM Mutations; key | a | b -----+-------------------+------------------- 1 | value from UPDATE | value from INSERT
  • 8. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr CQL 3 – Super Column Abandon des Super Columns  Colonne dont la valeur est des colonnes → Préférer désormais l'utilisation de clustering keys buzz AGE ADRESSE 32 NUMERO RUE VILLE 90 Baudin Levallois
  • 9. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr CQL 3 – Modélisation (Wide Rows) Wide Rows Cassandra peut stocker plus de 2M de colonnes par clef. Exemple :  → Comment faire avec CQL 3 ?  buzz 133829 133950 134022 142109 Star command ... Vers l'infini Où est Zurg ? Space command ... woody 133983 134802 J'ai un serpent ... Qui a empoisonné ... KEY COLUMNS ...
  • 10. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr CQL 3 – Modélisation (Wide Rows) buzz 133829-dialog 133950-dialog 134022-dialog 142109-dialog Star command ... Vers l'infini Où est Zurg ? Space command ... woody 133983-dialog 134802-dialog J'ai un serpent ... Qui a empoisonné ... CREATE TABLE DIALOG ( username VARCHAR, said_at TIMESTAMP, dialog VARCHAR, PRIMARY KEY (username, said_at) ) username said_at dialog buzz 133829 Star command ... buzz 133950 Vers l'infini ... ... woody 133983 J'ai un serpent ... ... Représentation Logique Représentation Physique Partition key Clustering key
  • 11. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr AGILITE CQL 3 - Performances
  • 12. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr AGILITE CQL 3 - Performances Attention : performance des SELECT * 
  • 13. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr AGILITE CQL Binary Protocol CQL Binary Protocol remplaçant de Thrift Thrift : rapide et multi-language  Pourquoi changer ? RPC seulement.  CQL Binary Protocol ouvre la porte au streaming (curseurs), aux notifications techniques, … Mais Thrift reste maintenu
  • 14. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr AGILITE CQL Binary Protocol  Nouveau port (9042 par défaut)  Actif par défaut Cassandra 1.2.5+  Peut cohabiter avec l'interface Thrift $CASSANDRA_HOME/conf/cassandra.yaml # Whether to start the native transport server. # Please note that the address on which the native transport is bound is the # same as the rpc_address. The port however is different and specified below. start_native_transport: true # port for the CQL native transport to listen for clients on native_transport_port: 9042 # Whether to start the thrift rpc server. start_rpc: true # port for Thrift to listen for clients on rpc_port: 9160
  • 15. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr AGILITE Java Driver Java Driver Fonctionnalités  Query  Query Builder  Prepared Statements  Exécution asynchrone  Métriques  Politiques
  • 16.
  • 17. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr AGILITE Java Driver - QueryBuilder QueryBuilder :   Construction de requêtes typées  Fluent API Opérations supportées  SELECT  UPDATE  INSERT  DELETE  BATCH Pas encore d’opérations de DDL (prévu en 1.1.0)
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr Java Driver – Policies ReconnectionPolicy  ConstantReconnectionPolicy // ré-éssai à intervall régulier  ExponentialReconnectionPolicy LoadBalancingPolicy  DCAwareRoundRobinPolicy // load balance au sein d'un DC  RoundRobinPolicy  TokenAwarePolicy // load balance sur les nœuds qui ont la data RetryPolicy  DowngradingConsistencyPolicy  LoggingRetryPolicy
  • 24. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr AGILITE CONCLUSION Java Driver utilise un nouveau socle tourné vers les futures releases de Cassandra  CQL 3  Adoption par utilisateurs SQL facilitée  Représentation logique de stockages spécifiques  CQL Binary Protocol  Taillé pour la forte volumétrie  Permettra d'accueillir de nouvelles fonctionnalités (ex :  curseurs) 1ère implémentation de ces 2 socles API très agréable à utiliser Très configurable/extensible
  • 25. www.ippon.fr www.atomes.com www.ippon-mobile.fr http://blog.ippon.fr Liens C* Summit 2013 :   http://planetcassandra.org/Learn/CassandraSummit NYC* 2013 - New Cassandra Drivers in Depth«   » Michael Figuière Documentation :   http://www.datastax.com/doc-source/developer/java-driver/ Benchs  https://github.com/brianfrankcooper/YCSB  https://github.com/vberetti/YCSB