getting started with riak - nosql live 2010 - boston

20
Rusty Klophaus (@rklophaus) Sr. Engineer | Basho Technologies http://www.basho.com [email protected] Getting started with Riak NoSQL Live · Boston, MA · March 2010

Upload: rusty-klophaus

Post on 08-May-2015

11.577 views

Category:

Technology


0 download

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.

TRANSCRIPT

Page 1: Getting Started with Riak - NoSQL Live 2010 - Boston

Rusty Klophaus (@rklophaus)Sr. Engineer | Basho Technologieshttp://[email protected]

Getting started with RiakNoSQL Live · Boston, MA · March 2010

Page 2: Getting Started with Riak - NoSQL Live 2010 - Boston

Rusty Klophaus• Senior Engineer

• Joined in August ‘09

Andy Gross• VP of Engineering

• Joined in December ’07

Bryan Fink• Engineering Manager

• Joined in February ’08

Mark Phillips• Community Manager

• Joined in April ’08

Introductions

2

Page 3: Getting Started with Riak - NoSQL Live 2010 - Boston

Follow the team:@basho/team

3

Page 4: Getting Started with Riak - NoSQL Live 2010 - Boston

There are 47 different NoSQL projects...

Where does Riak fit in?

4

Page 5: Getting Started with Riak - NoSQL Live 2010 - Boston

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

5

Page 6: Getting Started with Riak - NoSQL Live 2010 - Boston

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

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

Page 7: Getting Started with Riak - NoSQL Live 2010 - Boston

What characteristics of Riak become important at different cluster sizes?

7

Page 8: Getting Started with Riak - NoSQL Live 2010 - Boston

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

8

Page 9: Getting Started with Riak - NoSQL Live 2010 - Boston

Small Riak Cluster (~3 boxes)

• Distributed Queries for Performance / Capacity

• Javascript-based Map/Reduce (mini-Hadoop)

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

9

Page 10: Getting Started with Riak - NoSQL Live 2010 - Boston

Large Riak Cluster (10+ boxes)

• Homogenous - No special nodes

• Laugh in the face of machine failure

• Scale by adding machines

• Self-Contained Installation

10

Page 11: Getting Started with Riak - NoSQL Live 2010 - Boston

• On-Call Support 24x7x365

• Management Tools

• SNMP Monitoring

• Multi-site Replication

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

11

Page 12: Getting Started with Riak - NoSQL Live 2010 - Boston

• On-Call Support 24x7x365

• Management Tools

• SNMP Monitoring

• Multi-site Replication

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

12

Page 13: Getting Started with Riak - NoSQL Live 2010 - Boston

TutorialGet Riak

Connect with a Client

Store Data

Store an Object with Links

Linkwalking

Map/Reduce

13

Page 14: Getting Started with Riak - NoSQL Live 2010 - Boston

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

Start Riakcd riakbin/riak start

14

Page 15: Getting Started with Riak - NoSQL Live 2010 - Boston

Connect with Python# Code is in ./riak/client_lib/pythonimport riak

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

15

Page 16: Getting Started with Riak - NoSQL Live 2010 - Boston

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

16

Page 17: Getting Started with Riak - NoSQL Live 2010 - Boston

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()

17

Page 18: Getting Started with Riak - NoSQL Live 2010 - Boston

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()

18

Page 19: Getting Started with Riak - NoSQL Live 2010 - Boston

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

19

Page 20: Getting Started with Riak - NoSQL Live 2010 - Boston

Thanks! / Questions?Questions?

[email protected] (Public Mailing List)

[email protected] (Core Riak Team)

• Follow @basho/team (Basho Twitter List)

Riak Resources• http://riak.basho.com

• http://downloads.basho.com

• ./riak/client_lib <--- Python, JS, Java, PHP libraries

20