Skip to content

Latest commit

 

History

History
54 lines (45 loc) · 1.68 KB

gr8us-2015-cassandra-grails-extra.md

File metadata and controls

54 lines (45 loc) · 1.68 KB

Tools


Glossary

  • CAP Theorem - Consistency, Availability, and Partition tolerance
  • Cluster, DataCenter, Rack
  • Partitioner
  • Thrift
  • Quorum, Local Quorum

--

Glossary


Interesting Cassandra Modeling

session.prepare("""
   BEGIN BATCH
     INSERT INTO ${keyspace}.oauth_access_token
        (oauth_token, access_token, authentication, last_modified)
        VALUES (?, ?, ?, ?);
     INSERT INTO ${keyspace}.oauth_access_token_by_refresh
        (refresh_token, access_token, authentication, last_modified)
        VALUES (?, ?, ?, ?);
     INSERT INTO ${keyspace}.oauth_access_token_by_authentication
        (authentication_id, access_token, authentication, last_modified)
        VALUES (?, ?, ?, ?);
     INSERT INTO ${keyspace}.oauth_access_token_by_client
        (client_id, client_mod, user_id, access_token, authentication, last_modified)
        VALUES (?, ?, ?, ?, ?, ?);
   APPLY BATCH;
   """).setConsistencyLevel(ConsistencyLevel.ONE)

--

Client Mod

Create a Mod for every client that goes to a known set of buckets

Hashing.consistentHash(Hashing.murmur3_32()
    .hashString(userName, Charsets.UTF_8), 10)