19
Rusty Klophaus (@rklophaus) Basho Technologies Riak from Small to Large (about 2 minutes until start) Berlin Buzzwords · June 2010

Riak from Small to Large

Embed Size (px)

DESCRIPTION

Riak (http://basho.com), a dynamo-inspired, open-source key/value datastore, was built to scale from a single machine to a 100+ cluster without driving you or your operations team crazy. This presentation points out the characteristics of Riak that become important in small, medium, and large clusters, and then demonstrates the Riak API via the Python client library.

Citation preview

Page 1: Riak from Small to Large

Rusty Klophaus (@rklophaus)Basho Technologies

Riak from Small to Large(about 2 minutes until start)

Berlin Buzzwords · June 2010

Page 2: Riak from Small to Large

IntroductionRiak at Scale

Using the Riak API

2

Page 3: Riak from Small to Large

There are 47 different NoSQL projects...

3

Where does Riak fit in?

Page 4: Riak from Small to Large

Riak is a Dynamo-inspired,open-sourced, key/value datastorebuilt to scale predictably and easily.

4

Page 5: Riak from Small to Large

Your ops guy: calm, relaxed, and wearing a party hat.

Riak is a Dynamo-inspired open-sourced, key/value datastorebuilt to scale predictably and easily.

Page 6: Riak from Small to Large

What characteristics of Riak become important at different cluster sizes?

6

Page 7: Riak from Small to Large

Single Box Riak

• NoSQL - Key/Value, Flexible Schema• Clients in Ruby, Python, Javascript, Java, PHP, Erlang• Development Interface === Production Interface • Configurable Buckets - “A Profile is not an .mp3”• Links - Lightweight Data Relations

7

Page 8: Riak from Small to Large

Small Riak Cluster (~3 boxes)

• Distributed Queries for Performance / Capacity• Javascript-based Map/Reduce (mini-Hadoop) • Pre- and Post- Commit Hooks• Well-Behaved HTTP

• nginx proxy config - http://gist.github.com/323048

• Protocol Buffers8

Page 9: Riak from Small to Large

Large Riak Cluster (10+ boxes)

• Homogenous - No special nodes• Laugh in the face of machine failure• Scale by adding machines• Self-Contained Installation

9

Page 10: Riak from Small to Large

• On-Call Support 24x7x365 • Management Tools• SNMP Monitoring• Multi-site Replication

Enterprise ($$$ / ~10’s of boxes)

10

Page 11: Riak from Small to Large

• On-Call Support 24x7x365• Management Tools • SNMP Monitoring• Multi-site Replication

Enterprise ($$$ / ~10’s of boxes)

11

Page 12: Riak from Small to Large

TutorialGet Riak

Connect with a Client

Store Data

Store an Object with Links

Linkwalking

Map/Reduce

12

Page 13: Riak from Small to Large

Get RiakDownloadhttp://downloads.basho.com/riak

Start Riakcd riakbin/riak start

13

Page 14: Riak from Small to Large

Connect with Python# Code is at http://hg.basho.comimport riak

# Connectclient = riak.RiakClient('127.0.0.1', 8098)

14

Page 15: Riak from Small to Large

Store Datamybucket = client.bucket('mybucket')

# Create an object...obj = mybucket.new('myobject')obj.set_data({ 'foo' : 1, 'bar' : 2 })obj.store()

# Read the object...obj = mybucket.get('myobject')print obj.get_data()

# Or, open a web browser...http://127.0.0.1:8098/riak/mybucket/myobject

15

Page 16: Riak from Small to Large

Store an Object with Linksbands = client.bucket('bands')albums = client.bucket('albums')members = client.bucket('members')

# Store a band, link to album and members...obj = bands.new('Winger') \ .add_link(albums.new('Pull', 1275922).store()) \ .add_link(albums.new('IV', 542731).store()) \ .add_link(albums.new('Karma', 200170).store()) \ .add_link(members.new('Kip Winger').store()) \ .add_link(members.new('Reb Beach').store()) \ .add_link(members.new('John Roth').store()) \ .add_link(members.new('Rod M.').store()) \ .store()

16

Page 17: Riak from Small to Large

Linkwalking# Get the albums...albums = obj.link('albums').run()

# Get the songs (assumes data is present)...songs = obj.link('albums').link('songs').run()

# Get the members...members = riak.MapReduce(client) \ .add('bands', 'Winger') \ .link('members') \ .run()

17

Page 18: Riak from Small to Large

Map/Reduce# Count the number of sales...result = obj \ .link('albums') \ .map("function(v) { return [v.values[0].data]; }") \ .reduce("Riak.reduceSum") \ .run()

18

Page 19: Riak from Small to Large

Thanks! Questions?Next Steps

Read more at http://wiki.basho.com

Download binaries from http://downloads.basho.com

Get source code from http://hg.basho.com

Join the public mailing list at [email protected]

Mailing list archives at http://riak.markmail.org

Thanks!

Rusty Klophaus (@rklophaus)

19