http://bit.ly/tcjug-cassandra
Jeff Beck
beckje01 on GitHub and Twitter
TechLead at ReachLocal
Great talk on Cassandra consistency, Eventual Consistency != Hopeful Consistency
Thrift based with varying compatibility. Also supports some CQL3 via Thrift.
See Astyanax Cassandra Compatability
Not as popular anymore, allows for connection pooling etc. Based on Thrift.
Avoid these currently are not cluster aware so a single node failure can cause problems. Or you have to follow the bad practice having a LB in front of the cluster.
There are a lot of other clients and ORMs built out around Java check out all them here.
Based around CQL3 and a new binary protocol. Supports node discovery, load balancing and failover. Encourages CQL3 based data design.
CQL prepared statements claim to be 10% faster than thrift, with the first release. You have to model your data more like a traditional DB. It is new and comes in two flavors.
Currently a generally available client, docs are good to help get you started. You don't get all the great async work that has been done in 2.x
Many breaking changes for the upgrade and requires Cassandra 2.0 for full feature set many items such as result set paging will throw an exception if used against a 1.2 C*. Current state is 2.0.1, it does have nice async support with futures.
Netflix announced that they will be updating Astyanax to support both the new binary protocol and thrift. Read here. There is even a beta out of Astyanax Over Java Driver very early.
Model what you want to query for not the data.
This part is hard there will be mistakes.
CREATE KEYSPACE Simple WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor': 1}; CREATE TABLE Person ( firstName varchar, lastName varchar, age int, PRIMARY KEY (lastName,firstName) );
insert into person (firstname, lastname, age) values ('Jeff','Beck',30) ; insert into person (firstname, lastname, age) values ('Bob','Beck',60) ;
create table alist ( page varchar, visits list <timestamp>, PRIMARY KEY(page) );
update alist set visits=visits+['2014-04-14 19:34:20-0500'] where page='/fake' ;
Update.Assignments updateAssignments = QueryBuilder.update(keyspaceName, table).with(); for (PersistentProperty prop : persistentEntity.getPersistentProperties()){ updateAssignments = updateAssignments.and(QueryBuilder.set(prop.getName(), convertToCassandraType(entry.get(prop.getName())))); }
Statement update = updateAssignments.where(QueryBuilder.eq("id", UUID.fromString(uuid.toString())));
session.execute(update);
ByteBuffer bb = row.getBytes(columnName); byte[] result = new byte[bb.remaining()]; bb.get(result); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(result); ObjectInputStream ois = new ObjectInputStream(byteArrayInputStream); o = ois.readObject();
http://www.meetup.com/Minneapolis-St-Paul-Cassandra-Meetup/ http://bit.ly/C-MSP