This document provides an introduction to Riak and Ripple. It summarizes that Riak is a distributed key-value store inspired by Amazon Dynamo that allows scaling by adding more machines. It stores data in buckets and uses JavaScript for MapReduce functions. The document demonstrates basic usage of the Riak client and RObject in Ruby, and explains how links enable lightweight relationships between objects and can be traversed through link walking. It also provides an example of a MapReduce function in JavaScript.
17. Key-Value++
• Data objects are identified by keys,
and have metadata
• Keys are grouped in buckets
• Links enable lightweight
relationships
18. Key-Value++
• Data objects are identified by keys,
and have metadata
• Keys are grouped in buckets
• Links enable lightweight
relationships
• Query with MapReduce
23. Sans-Schema
• Buckets created on the fly
• Values are opaque
•Content-Type matters
•The application defines the
semantics:
more flexibility, more responsibility
27. Web-Friendly
•HTTP is primary interface
•JSON is used for structured data
•Javascript is used for
MapReduce functions
28. Web-Friendly
•HTTP is primary interface
•JSON is used for structured data
•Javascript is used for
MapReduce functions
•Plays well with Varnish, Squid,
HAProxy, F5, etc.
29. Web-Friendly
•HTTP is primary interface
•JSON is used for structured data
•Javascript is used for
MapReduce functions
•Plays well with Varnish, Squid,
HAProxy, F5, etc.
[see also Webmachine]
39. Getting Started
• Download a package from
http://downloads.basho.com
• Set the node name, IPs
• Start up the node
40. Getting Started
• Download a package from
http://downloads.basho.com
• Set the node name, IPs
• Start up the node
• Join a cluster
41. Getting Started
• Download a package from
http://downloads.basho.com
• Set the node name, IPs
• Start up the node
• Join a cluster
• Start storing/retrieving values
50. require ‘riak’
• Make a client object
client = Riak::Client.new
• Get a bucket
bucket = client.bucket(‘foo’) # Riak::Bucket
51. require ‘riak’
• Make a client object
client = Riak::Client.new
• Get a bucket
bucket = client.bucket(‘foo’) # Riak::Bucket
• Get an object from the bucket
obj = bucket.get(‘bar’) # Riak::RObject
52. require ‘riak’
• Make a client object
client = Riak::Client.new
• Get a bucket
bucket = client.bucket(‘foo’) # Riak::Bucket
• Get an object from the bucket
obj = bucket.get(‘bar’) # Riak::RObject
• Initialize a new object
obj = bucket.new(‘baz’)
74. Links in Ruby API
• Create a link
Riak::Link.new(“/riak/bucket/key”,
“tag”)
75. Links in Ruby API
• Create a link
Riak::Link.new(“/riak/bucket/key”,
“tag”)
• Read an#object’s links
obj.links Set<Riak::Link>
76. Links in Ruby API
• Create a link
Riak::Link.new(“/riak/bucket/key”,
“tag”)
• Read an#object’s links
obj.links Set<Riak::Link>
• Convert<< obj2.to_link(“next”)
obj.links
an object to a link
obj.store
80. Link-Walking
• Asks Riak to traverse a sequence of
links via special URL
• Filter by bucket/tag
• Can return results from
intermediate traversals
81. Link-Walking
• Asks Riak to traverse a sequence of
links via special URL
• Filter by bucket/tag
• Can return results from
intermediate traversals
• Response is nested multipart/mixed
(riak-client handles this for you)
127. Document Models
class Person
include Ripple::Document
property :name, String, :presence => true
many :addresses
many :friends, :class => Person
end
class Address
include Ripple::EmbeddedDocument
property :street, String
end
143. Plug
Interested in learning about support,
consulting, or Enterprise features?
basho
144. Plug
Interested in learning about support,
consulting, or Enterprise features?
Email info@basho.com or go to
http://www.basho.com/
contact.html to talk with us.
basho
145. Plug
Interested in learning about support,
consulting, or Enterprise features?
Email info@basho.com or go to
http://www.basho.com/
contact.html to talk with us.
basho
146. Plug
Interested in learning about support,
consulting, or Enterprise features?
Email info@basho.com or go to
http://www.basho.com/
contact.html to talk with us.
www.basho.com
sean@basho.com
@seancribbs
basho