Terrastore - A document database for developers
Upcoming SlideShare
Loading in...5
×
 

Terrastore - A document database for developers

on

  • 7,999 views

 

Statistics

Views

Total Views
7,999
Views on SlideShare
6,701
Embed Views
1,298

Actions

Likes
5
Downloads
54
Comments
2

7 Embeds 1,298

http://nosql.mypopescu.com 1085
http://www.nosqldatabases.com 205
http://translate.googleusercontent.com 4
http://www.onlydoo.com 1
http://static.slidesharecdn.com 1
http://feeds.feedburner.com 1
https://translate.googleusercontent.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Terrastore - A document database for developers Terrastore - A document database for developers Presentation Transcript

  • Sergio Bossa @sbtourist Terrastore A document database for developers
  • About Me Software architect and engineer Gioco Digitale (online gambling and casinos). Long time open source enthusiast and contributor Spring. Taconite. Terracotta. Actorom, Terrastore ... (Micro)-Blogger http://twitter.com/sbtourist http://sbtourist.blogspot.com
  • NOSQL ... what? 1998 Just a tiny non-relational database. 2009 Non-relational databases as a replacement for relational ones? Nowadays ... Not Only SQL. Use the right tool for your job.
  • NOSQL ... why? When you're in troubles with ... Data Model. Relational mismatch. Variable schema. Data Access Patterns. Expensive joins. Denormalized data. Scalability. More data. More processing.
  • No SQL, Yes ... ? Heterogeneity. Key/Value based. Voldemort. Document based. MongoDB. Riak. Terrastore. Column based. Cassandra. HBase. Graph based. Neo4J.
  • Terrastore! Document Store. Ubiquitous. Consistent. Distributed. Scalable. Written in Java. Based on Terracotta. Open Source. Apache-licensed.
  • Your data, your documents { "name" : "Sergio", "surname" : "Bossa", "twitter" : "@sbtourist" }
  • Access everywhere
  • Keep consistent
  • Distribute as a single cluster
  • Distribute as multiple clusters
  • But ... Why Terrastore?!?!
  • Make ...
  • Simple things easy
  • Complex things possible ( almost ;)
  • Get started in seconds One command installation and startup ... $> ant -f terrastore-install.xml quickstart -Dquickstart.dir=...
  • Easy installation Master: $> ant -f terrastore-install.xml single-master -Dmaster.server.port 9510 -Dinstall.dir=... Server: $> ant -f terrastore-install.xml server -Dinstall.dir=...
  • No complex configuration Master: $master>./start.sh Server: $server>./start.sh --master --httpHost --httpPort --nodeHost --nodePort ...
  • No impedence mismatch Java: public class Character { private String name; private List<Character> friends; private List<Character> foes; // ... } Json: {"name" : "Spider-man", "friends" : [{"name" : "Iceman"}] "foes" : [{"name" : "Kingpin"}]}
  • Simple basic operations Put documents in buckets ... PUT /bucket/key Content-Type: application/json {...} Get documents from buckets ... GET /bucket/key Content-Type: application/json {...}
  • Range queries Find documents in bucket with keys in a given range ... GET /bucket/range?comparator=comparator_name& startKey=start_key& endKey=end_key& timeToLive=max_age Content-Type: application/json {...}
  • Built-in comparators Lexicographical Ascendant. Descendant. Numerical. Ascendant. Descendant.
  • What if ... custom comparators? @AutoDetect(name="my-comparator") public class MyComparator implements terrastore.store.operators.Comparator { public int compare(String key1, String key2) { // ... } }
  • Predicate queries Find documents in bucket satisfying a given predicate condition ... GET /bucket/predicate? predicate=type:expression Content-Type: application/json {...}
  • Conditional put/get Conditionally put documents in buckets ... PUT /bucket/key? predicate=type:expression Content-Type: application/json {...} Conditionally get documents from buckets ... GET /bucket/key? predicate=type:expression Content-Type: application/json {...}
  • Built-in predicate conditions JXPapth Based on X-Path. Find people whose name is 'Sergio': jxpath:/name[.='Sergio'] JavaScript Applies a JavaScript-like condition. Find people whose name is 'Sergio': js:value.name=='Sergio'
  • What if ... custom conditions? @AutoDetect(name="my-condition") public class MyCondition implements terrastore.store.operators.Condition { public boolean isSatisfied(String key, Map<String, Object> value, String expression) { // ... } }
  • Server-side updates Atomically execute complex updates to a document ... PUT /bucket/key/update?function=function_name& timeout=timeout_value Content-Type: application/json {...}
  • Built-in update functions Atomic Counters Atomically increment/decrement/set-up one or more counters. Merge Merge the stored document with provided values. JavaScript custom update Update the stored document by executing a user- provided javascript function.
  • What if ... custom functions? @AutoDetect(name="my-function") public class MyFunction implements terrastore.store.operators.Function { public Map<String, Object> apply(String key, Map<String, Object> value, Map<String, Object> parameters) { // ... } }
  • Easy scale-out A command line parameter: $server>./start.sh --master --ensemble And a json configuration file: { "localCluster" : "apple", "discoveryInterval" : 5000, "clusters" : ["apple", "orange"], "seeds" : {"orange" : "192.168.1.2:6001"} }
  • DSL-like Java APIs Fluent APIs. Http-based. Transparent (yet configurable) object conversion. // Create client: TerrastoreClient client = new TerrastoreClient("http://localhost:8080", new HTTPConnectionFactory()); // Create object: Person sbtourist = new Person("Sergio Bossa”, "sbtourist") // Put: client.bucket("people").key("1").put(person); // Get: sbtourist = client.bucket("people").key("1").get(Person.class);
  • Support for other languages Clojure http://github.com/sbtourist/terrastore-cloj Python http://dnene.bitbucket.org/docs/pyterrastore Scala http://github.com/ssuravarapu/Terrastore-Scala-Client http://github.com/teigen/terrastore-scala Easy to add more!
  • Pure Javascript Web Console
  • More! Backup Import/export documents to/from buckets. Events management Get notified of document updates. Third-party products integration. Write-behind. ActiveMQ integration for higher reliability. Custom data partitioning Retain control of where your data is placed. Indexing and searching Terrastore-Search. ElasticSearch integration. Cross-origin resource sharing support Integrate with browser-based clients.
  • Now that I have an hammer ... Don't go blinded. Use the right tool for the job! Terrastore is best suited for: Data hot spots. Computational data. Complex, rich or variable data. Throw-away data.
  • Final words ... engaging. Explore http://code.google.com/p/terrastore Download http://code.google.com/p/terrastore/downloads/list Hack http://code.google. com/p/terrastore/source/checkout Participate http://groups.google.com/group/terrastore- discussions Enjoy!
  • Q&A Contact me on: http://twitter.com/sbtourist