#CASSANDRAEU

Cassandra made simple
with CQL drivers and DevCenter

Michaël Figuiere, Software Engineer, DataStax
!
Alex P...
Agenda

•Why building tools for Cassandra?
•DataStax Drivers
• Core values

•Introducing DevCenter

#CASSANDRAEU
Motivation

«Use the right tool for the job»

... the best tools for the job

#CASSANDRAEU
Why building tools for C*

•Too many choices
•Best practices
•distributed systems
•modern applications
•Friendly, Familiar...
One way or another
•Learn & experiment
•Implement
•Test
•Integrate
!

•Repeat

#CASSANDRAEU
CQL The new face of Cassandra
* CQL
* Simpler Data Model using Denormalized Tables
* SQL-like Query Language
* Schema Defi...
CQL Drivers Overview
* Reference Implementation
* Asynchronous architecture based on Netty
* Prepared Statements Support
*...
Request Pipelining
Client

Cassandra

Without
Request
Pipelining
Client

Cassandra

With
Request
Pipelining
Notifications
Node

Client
Node

Node

With	

Notifications

Node

Client

Node

Without	

Notifications

Node
Asynchronous Architecture
Nod

Client
Thread
Nod

Client
Thread

Driver
Nod

Client
Thread

Nod
Asynchronous Architecture
Nod

Client
Thread

6
Nod

1
Client
Thread

2

Driver

3
Nod

5
Client
Thread

4
Nod
Connect and Write
Cluster cluster = new Cluster.builder()	
.addContactPoints("10.0.0.1", "10.0.0.2")	
.build();	
!
Session...
Read from a table
ResultSet rs = session.execute("SELECT * FROM test");	
!
List<Row> rows = rs.all();	
	
for (Row row : ro...
Asynchronous Read
ResultSetFuture future =	
session.executeAsync("SELECT * FROM test");	
!
for (Row row : future.get()) {	...
Read with Callbacks
final ResultSetFuture future =	
session.executeAsync("SELECT * FROM test");	
!
future.addListener(new ...
Using Prepared Statements
public void setUserByPreparedStatement(User user) {!
!
BoundStatement bs = setUser.bind();!
!
bs...
Using the Query Builder
Query query = select().all().from("videodb", "videos")!
.where(eq("videoId", videoId)).limit(10);!...
Load Balancing and Failover
Respons
e	


5

Retry	

Policy	

4

6

Client	


1

Load
Balancing
Policy	


3

Node

Node

2
...
Multi Datacenter Load Balancing
Datacenter A
Client	


Node

Client	


Node

Client	


Node

Client	


Node

Client	

Clie...
Token Aware Load Balancing
Replic
Node
a

Node

Replic
Node

Client	


a

Node

Replic
a

Node

Nodes that own
a Replica o...
Add a Load Balancing Policy
!
!
cluster = Cluster.builder()!
.addContactPoints("10.0.0.1", "10.0.0.2")	
.withLoadBalancing...
Automatic Paging
Nod

Query

Client	


Page 1	

+ Paging State 1

Repli

Nod

Repli

Nod

Repli
Automatic Paging
Nod

Repli

Query + Paging State 1
Client	


Nod

Repli

Page 2 + Paging State 2
Nod

Repli
Introducing DevCenter 1.0
DevCenter

#CASSANDRAEU

•DevCenter is a free visual query tool that can be used by
both developers and admins for creatin...
DevCenter

#CASSANDRAEU

Pull a Steve Jobs...

... brag about how
brilliant DevCenter is
#CASSANDRAEU

Quick links

*DataStax drivers:
http://github.com/datastax

*DevCenter:
http://www.datastax.com/dev/blog/dat...
Upcoming SlideShare
Loading in...5
×

C* Summit EU 2013: Cassandra Made Simple with CQL Drivers and DevCenter

818

Published on

Speakers: Michaël Figuiere, Software Engineer at DataStax & Alex Popescu, Senior Product Manager at DataStax
Video: http://www.youtube.com/watch?v=hK2dXLiYVMI&list=PLqcm6qE9lgKLoYaakl3YwIWP4hmGsHm5e&index=11
Is Cassandra too complex for newcomers? Besides the many improvements that have made their way into C* to dramatically simplify it and the finalized Cassandra Query Language, the SQL-like query language that should look familiar, new drivers have been created with a modern and efficient API. Last, but not least, DataStax is introducing *today* DevCenter 1.0, an IDE whose goal is to simplify developer's workflow even further and to improve their productivity. This presentation will show you how putting to work the new drivers and DevCenter can make your daily life with Cassandra nicer!

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
818
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
15
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

C* Summit EU 2013: Cassandra Made Simple with CQL Drivers and DevCenter

  1. 1. #CASSANDRAEU Cassandra made simple with CQL drivers and DevCenter Michaël Figuiere, Software Engineer, DataStax ! Alex Popescu, Sen.Product Manager, DataStax
  2. 2. Agenda •Why building tools for Cassandra? •DataStax Drivers • Core values •Introducing DevCenter #CASSANDRAEU
  3. 3. Motivation «Use the right tool for the job» ... the best tools for the job #CASSANDRAEU
  4. 4. Why building tools for C* •Too many choices •Best practices •distributed systems •modern applications •Friendly, Familiar, Integrated experience #CASSANDRAEU
  5. 5. One way or another •Learn & experiment •Implement •Test •Integrate ! •Repeat #CASSANDRAEU
  6. 6. CQL The new face of Cassandra * CQL * Simpler Data Model using Denormalized Tables * SQL-like Query Language * Schema Definition * CQL Native Protocol * Introduced in Cassandra 1.2 * Designed for CQL * Thrift will keep being supported by Cassandra
  7. 7. CQL Drivers Overview * Reference Implementation * Asynchronous architecture based on Netty * Prepared Statements Support * Automatic Fail-over * Node Discovery * Cassandra Tracing Support * Tunable Policies !
  8. 8. Request Pipelining Client Cassandra Without Request Pipelining Client Cassandra With Request Pipelining
  9. 9. Notifications Node Client Node Node With Notifications Node Client Node Without Notifications Node
  10. 10. Asynchronous Architecture Nod Client Thread Nod Client Thread Driver Nod Client Thread Nod
  11. 11. Asynchronous Architecture Nod Client Thread 6 Nod 1 Client Thread 2 Driver 3 Nod 5 Client Thread 4 Nod
  12. 12. Connect and Write Cluster cluster = new Cluster.builder() .addContactPoints("10.0.0.1", "10.0.0.2") .build(); ! Session session = cluster.connect("myKeyspace"); ! session.execute( "INSERT INTO user (user_id, name, email) VALUES (12345, 'johndoe', 'john@doe.com')" );
  13. 13. Read from a table ResultSet rs = session.execute("SELECT * FROM test"); ! List<Row> rows = rs.all(); for (Row row : rows) { ! String userId = row.getString("user_id"); String name = row.getString("name"); String email = row.getString("email"); }
  14. 14. Asynchronous Read ResultSetFuture future = session.executeAsync("SELECT * FROM test"); ! for (Row row : future.get()) { ! String userId = row.getString("user_id"); String name = row.getString("name"); String email = row.getString("email"); }
  15. 15. Read with Callbacks final ResultSetFuture future = session.executeAsync("SELECT * FROM test"); ! future.addListener(new Runnable() { public run() { for (Row row : future.get()) { ! String userId = row.getString("user_id"); String name = row.getString("name"); String email = row.getString("email"); } } }, executor);
  16. 16. Using Prepared Statements public void setUserByPreparedStatement(User user) {! ! BoundStatement bs = setUser.bind();! ! bs.setString("username", user.getUsername());! bs.setString("firstname", user.getFirstname());! bs.setString("lastname", user.getLastname());! bs.setString("email", user.getEmail());! bs.setDate("created_date", user.getCreated_date());! ! ! ! session.execute(bs); ! }
  17. 17. Using the Query Builder Query query = select().all().from("videodb", "videos")! .where(eq("videoId", videoId)).limit(10);! ! query.setConsistencyLevel(ConsistencyLevel.ONE);! ! ResultSet rs = session.execute(query);!
  18. 18. Load Balancing and Failover Respons e 5 Retry Policy 4 6 Client 1 Load Balancing Policy 3 Node Node 2 Node Health Monitor Notifications Reconnection
  19. 19. Multi Datacenter Load Balancing Datacenter A Client Node Client Node Client Node Client Node Client Client Node Node Datacenter B Local nodes are queried first, if non are available, the request will be sent to a remote node.
  20. 20. Token Aware Load Balancing Replic Node a Node Replic Node Client a Node Replic a Node Nodes that own a Replica of the data being read or written by the query will be contacted first.
  21. 21. Add a Load Balancing Policy ! ! cluster = Cluster.builder()! .addContactPoints("10.0.0.1", "10.0.0.2") .withLoadBalancingPolicy(Policies.defaultLoadBalancingPolicy())! .build();! ! session = cluster.connect(keyspace);! Create your own policy!
  22. 22. Automatic Paging Nod Query Client Page 1 + Paging State 1 Repli Nod Repli Nod Repli
  23. 23. Automatic Paging Nod Repli Query + Paging State 1 Client Nod Repli Page 2 + Paging State 2 Nod Repli
  24. 24. Introducing DevCenter 1.0
  25. 25. DevCenter #CASSANDRAEU •DevCenter is a free visual query tool that can be used by both developers and admins for creating and running CQL queries and commands against Apache Cassandra and DataStax Enterprise •DevCenter is the smarter and friendlier brother of cqlsh
  26. 26. DevCenter #CASSANDRAEU Pull a Steve Jobs... ... brag about how brilliant DevCenter is
  27. 27. #CASSANDRAEU Quick links *DataStax drivers: http://github.com/datastax *DevCenter: http://www.datastax.com/dev/blog/datastaxdevcenter-1-0-is-here http://www.datastax.com/download/clientdrivers !
  1. Gostou de algum slide específico?

    Recortar slides é uma maneira fácil de colecionar informações para acessar mais tarde.

×