SlideShare a Scribd company logo
Riak and Node.js: Best
served with HTTP
Philipp Fehre https://github.com/sideshowcoder
Riak Intro at Munich Node.js
What is Riak?
A Key Value store
A Dynamo store!
Distributed
Riak Intro at Munich Node.js
Riak Intro at Munich Node.js
Replicated
Riak Intro at Munich Node.js
Fault tolerant
Riak Intro at Munich Node.js
Riak Intro at Munich Node.js
Riak Intro at Munich Node.js
Scaling
Basically means add more machines
Gains
more storage
more throughput
lower latency
And it is Web friendly
HTTP Interface
Value is irrelevant so you can store JSON
Support for JavaScript functions
When to use Riak
Riak Intro at Munich Node.js
Data Organization
keys identify objects
objects have metadata
objects are grouped into buckets
More Data Features
Links
Secoundary indexes
Timeouts
HTTP
Riak understands simple HTTP
Create some data
curl -v -XPUT http://localhost:8098/riak/test/doc 
-H "Content-Type: application/json" 
-d '{"bar":"baz"}'
Query by key
curl -v http://localhost:8098/riak/test/doc
Everything can be done
via HTTP
like setting properties of
the bucket
curl -v -XPUT -H "Content-Type: application/json" 
-d '{"props":{"n_val":5}}'
or MapReduce
curl -XPOST http://localhost:8098/mapred 
-H 'Content-Type: application/json' 
-d '{ "inputs":"training",
"query":[{"map":{"language":"javascript",
"source":"function(riakObject) {
var val = riakObject.values[0].data.match(/pizza/g);
return [[riakObject.key, (val ? val.length : 0)]];
}"}}]}'
Ok but we do JavaScript
... or more like Node
Using Riak from Node
JavaScript all the way
down
if you want it to be!
The Client
var db = require("riak-js").getClient()
Store an Object
var obj = { val: "foo", bar: true }
db.save("foos", "foo_1", obj, {}, function(err) {
if(!err) console.log("stored")
})
Retrieve an Object
db.get("foos", "foo_1", function(err, data, meta) {
if(!err) {
console.log(data)
console.log(meta)
}
})
Map and Reduce
"MapReduce is a programming model for processing large data
sets with a parallel, distributed algorithm on a cluster" -Wikipedia
Riak Intro at Munich Node.js
Riak MapReduce Queries
provide a set of keys
provide a map function
provide a reduce function
Select Keys
db.mapreduce.add("foos")
var key_filter = [["tokenize", "_", 1],
["to_lower"],
["matches", "foo"]]
db.mapreduce.add({ bucket: "foos", key_filters: key_filter })
Map a buildin
db.mapreduce
.add("foos")
.map({ name: 'Riak.mapValueJson', keep: true })
.run()
Map custom function
var func = function(v, _keyData, arg) {
var v = Riak.mapValuesJson(v)[0];
(v.val === "foo") ? return [v] : return [];
}
db.mapreduce.add("foos").map(func).run()
Reduce with custom
var func = function(values) {
return [ values.length ]
}
db.mapreduce...
.reduce(func)
.run()
A little more complex
function(values) {
return values.reduce(function(acc, v) {
if(v.bar) {
var curr = acc["bar"] || 0
acc["bar"] = curr + 1
}
return acc;
})
}
Questions
· Usergroup: www.meetup.com/Riak-Munchen/
· More on the basics: littleriakbook.com

More Related Content

ODP
Building a Cloud API Server using Play(SCALA) & Riak
RajthilakMCA
 
PDF
Solutions for bi-directional Integration between Oracle RDMBS & Apache Kafka
Guido Schmutz
 
PDF
ELK introduction
Waldemar Neto
 
PDF
elk_stack_alexander_szalonnas
Alexander Szalonnas
 
PPTX
Elastic - ELK, Logstash & Kibana
SpringPeople
 
PPTX
Elk
Caleb Wang
 
PDF
Data Analytics Service Company and Its Ruby Usage
SATOSHI TAGOMORI
 
PDF
Shipping & Visualize Your Data With ELK
Adam Chen
 
Building a Cloud API Server using Play(SCALA) & Riak
RajthilakMCA
 
Solutions for bi-directional Integration between Oracle RDMBS & Apache Kafka
Guido Schmutz
 
ELK introduction
Waldemar Neto
 
elk_stack_alexander_szalonnas
Alexander Szalonnas
 
Elastic - ELK, Logstash & Kibana
SpringPeople
 
Data Analytics Service Company and Its Ruby Usage
SATOSHI TAGOMORI
 
Shipping & Visualize Your Data With ELK
Adam Chen
 

What's hot (20)

PDF
Os riak1-pdf
Nguyen Thuy
 
PDF
Open Source Logging and Monitoring Tools
Phase2
 
PPTX
Customer Intelligence: Using the ELK Stack to Analyze ForgeRock OpenAM Audit ...
ForgeRock
 
PDF
Real-time data analysis using ELK
Jettro Coenradie
 
PDF
Kafka Summit NYC 2017 - Singe Message Transforms are not the Transformations ...
confluent
 
PDF
Logging logs with Logstash - Devops MK 10-02-2016
Steve Howe
 
PDF
Analyse your SEO Data with R and Kibana
Vincent Terrasi
 
PDF
Rethinking Syncing at AltConf 2019
Joe Keeley
 
PDF
Altitude NY 2018: Programming the edge workshop
Fastly
 
PPTX
05 integrate redis
Erhwen Kuo
 
PPTX
ELK Stack
Phuc Nguyen
 
PPTX
Attack monitoring using ElasticSearch Logstash and Kibana
Prajal Kulkarni
 
PDF
FlutterでGraphQLを扱う
IgaHironobu
 
PDF
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Fastly
 
PPT
'Scalable Logging and Analytics with LogStash'
Cloud Elements
 
PDF
Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...
confluent
 
PDF
Side by Side with Elasticsearch & Solr, Part 2
Sematext Group, Inc.
 
PDF
PUT Knowledge BUCKET Brain KEY Riak
Philipp Fehre
 
PDF
Resilient Applications with Akka Persistence - Scaladays 2014
Björn Antonsson
 
PPTX
Introduction to ELK
Harshakumar Ummerpillai
 
Os riak1-pdf
Nguyen Thuy
 
Open Source Logging and Monitoring Tools
Phase2
 
Customer Intelligence: Using the ELK Stack to Analyze ForgeRock OpenAM Audit ...
ForgeRock
 
Real-time data analysis using ELK
Jettro Coenradie
 
Kafka Summit NYC 2017 - Singe Message Transforms are not the Transformations ...
confluent
 
Logging logs with Logstash - Devops MK 10-02-2016
Steve Howe
 
Analyse your SEO Data with R and Kibana
Vincent Terrasi
 
Rethinking Syncing at AltConf 2019
Joe Keeley
 
Altitude NY 2018: Programming the edge workshop
Fastly
 
05 integrate redis
Erhwen Kuo
 
ELK Stack
Phuc Nguyen
 
Attack monitoring using ElasticSearch Logstash and Kibana
Prajal Kulkarni
 
FlutterでGraphQLを扱う
IgaHironobu
 
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Fastly
 
'Scalable Logging and Analytics with LogStash'
Cloud Elements
 
Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...
confluent
 
Side by Side with Elasticsearch & Solr, Part 2
Sematext Group, Inc.
 
PUT Knowledge BUCKET Brain KEY Riak
Philipp Fehre
 
Resilient Applications with Akka Persistence - Scaladays 2014
Björn Antonsson
 
Introduction to ELK
Harshakumar Ummerpillai
 
Ad

Similar to Riak Intro at Munich Node.js (20)

PDF
Relational Databases to Riak
Basho Technologies
 
PPT
Rolling With Riak
John Lynch
 
PDF
Riak at The NYC Cloud Computing Meetup Group
siculars
 
PPTX
Coding with Riak (from Velocity 2015)
Basho Technologies
 
KEY
Introduction to Riak - Red Dirt Ruby Conf Training
Sean Cribbs
 
KEY
Adding Riak to your NoSQL Bag of Tricks
siculars
 
KEY
How does Riak compare to Cassandra? [Cassandra London User Group July 2011]
Rainforest QA
 
KEY
Riak seattle-meetup-august
pharkmillups
 
PPTX
Bathcamp 2010-riak
Timothy Perrett
 
KEY
Introduction to Riak and Ripple (KC.rb)
Sean Cribbs
 
PDF
Riak from Small to Large
Rusty Klophaus
 
PDF
Introduction to Riak - Joel Jacobson
akqaanoraks
 
PDF
Riak at Engine Yard Cloud
Ines Sombra
 
PDF
Riak - From Small to Large - StrangeLoop
Rusty Klophaus
 
PDF
Riak - From Small to Large
Rusty Klophaus
 
PDF
Python and riak a perfect couple for building
Naren Arya
 
PDF
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Lucidworks
 
PDF
Getting Started with Riak - NoSQL Live 2010 - Boston
Rusty Klophaus
 
PDF
Getting started with Riak in the Cloud
Ines Sombra
 
KEY
Riak with node.js
Sean Cribbs
 
Relational Databases to Riak
Basho Technologies
 
Rolling With Riak
John Lynch
 
Riak at The NYC Cloud Computing Meetup Group
siculars
 
Coding with Riak (from Velocity 2015)
Basho Technologies
 
Introduction to Riak - Red Dirt Ruby Conf Training
Sean Cribbs
 
Adding Riak to your NoSQL Bag of Tricks
siculars
 
How does Riak compare to Cassandra? [Cassandra London User Group July 2011]
Rainforest QA
 
Riak seattle-meetup-august
pharkmillups
 
Bathcamp 2010-riak
Timothy Perrett
 
Introduction to Riak and Ripple (KC.rb)
Sean Cribbs
 
Riak from Small to Large
Rusty Klophaus
 
Introduction to Riak - Joel Jacobson
akqaanoraks
 
Riak at Engine Yard Cloud
Ines Sombra
 
Riak - From Small to Large - StrangeLoop
Rusty Klophaus
 
Riak - From Small to Large
Rusty Klophaus
 
Python and riak a perfect couple for building
Naren Arya
 
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Lucidworks
 
Getting Started with Riak - NoSQL Live 2010 - Boston
Rusty Klophaus
 
Getting started with Riak in the Cloud
Ines Sombra
 
Riak with node.js
Sean Cribbs
 
Ad

More from Philipp Fehre (18)

PPTX
node.js and native code extensions by example
Philipp Fehre
 
PDF
Jruby a Pi and a database
Philipp Fehre
 
PDF
Couchbase Mobile on Android
Philipp Fehre
 
PDF
From 0 to syncing
Philipp Fehre
 
PDF
Node.js and couchbase Full Stack JSON - Munich NoSQL
Philipp Fehre
 
PDF
You got schema in my json
Philipp Fehre
 
PDF
What is new in Riak 2.0
Philipp Fehre
 
PDF
Ember background basics
Philipp Fehre
 
PDF
Ember learn from Riak Control
Philipp Fehre
 
PDF
Testing tdd jasmine
Philipp Fehre
 
PDF
Testing tdd dom
Philipp Fehre
 
PDF
Something about node basics
Philipp Fehre
 
PDF
A little more advanced node
Philipp Fehre
 
PDF
Something about node in the realworld
Philipp Fehre
 
PDF
Campfire bot lightning talk
Philipp Fehre
 
PDF
Lighting fast rails with zeus
Philipp Fehre
 
PDF
JavaScript frontend testing from failure to good to great
Philipp Fehre
 
KEY
Network with node
Philipp Fehre
 
node.js and native code extensions by example
Philipp Fehre
 
Jruby a Pi and a database
Philipp Fehre
 
Couchbase Mobile on Android
Philipp Fehre
 
From 0 to syncing
Philipp Fehre
 
Node.js and couchbase Full Stack JSON - Munich NoSQL
Philipp Fehre
 
You got schema in my json
Philipp Fehre
 
What is new in Riak 2.0
Philipp Fehre
 
Ember background basics
Philipp Fehre
 
Ember learn from Riak Control
Philipp Fehre
 
Testing tdd jasmine
Philipp Fehre
 
Testing tdd dom
Philipp Fehre
 
Something about node basics
Philipp Fehre
 
A little more advanced node
Philipp Fehre
 
Something about node in the realworld
Philipp Fehre
 
Campfire bot lightning talk
Philipp Fehre
 
Lighting fast rails with zeus
Philipp Fehre
 
JavaScript frontend testing from failure to good to great
Philipp Fehre
 
Network with node
Philipp Fehre
 

Recently uploaded (20)

PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
Software Development Methodologies in 2025
KodekX
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
The Future of Artificial Intelligence (AI)
Mukul
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
Software Development Methodologies in 2025
KodekX
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 

Riak Intro at Munich Node.js