SlideShare una empresa de Scribd logo
1 de 33
Descargar para leer sin conexión
PUT Knowledge BUCKET
Brain KEY Riak
An intro to Riak
by Phil
github.com/sideshowcoder
twitter.com/ischi
Code
The slides contain code, this is how it works
a_string = "I am a string"
a_string
Ok so Riak, eh?
client = Riak::Client.new
bucket = client.bucket("brain")
object = bucket.get_or_new("riak")
object.content_type = "application/json"
object.data = { message: "Know stuff on riak!", level: "awesome" }
object.store
object.reload.data
What is Riak?
Key / Value Store
Distributed
Dynamo based
Buckets
client.bucket("brain").name
Keys
bucket.keys
Values
bucket.get("riak").data
Distributed
Keyspace is spread across the members of a cluster via Consistent
Hashing
Hashing
Key => Hash(key) => Result => 2ˆn -1 possible outcomes
Digest.hexencode Digest::MD5.digest("my-key")
Consistent Hashing
Source littleriakbook
Replication
Source littleriakbook
CAP Theorem
Consistency
Availability
Partition tolerance
Trade-offs
Riak chooses adjustable AP, which means it never reaches full
Consistency but can be tuned to the needs
N/R/W Values
N: Replication count
R: Min number of nodes to read from
W: Min number of nodes to write to
More on the basics behind
this?
Littleriakbook by Eric Redmond
dynamo paper
Ring members
$ riak-admin member-status
=========================== Membership ============================
Status Ring Pending Node
-------------------------------------------------------------------
valid 100.0% -- 'riak@127.0.0.1'
-------------------------------------------------------------------
Valid:1 / Leaving:0 / Exiting:0 / Joining:0 / Down:0
Ring Status
$ riak-admin ring-status
============================ Claimant =============================
Claimant: 'riak@127.0.0.1'
Status: up
Ring Ready: true
======================== Ownership Handoff ========================
No pending changes.
======================== Unreachable Nodes ========================
All nodes are up and reachable
Just Key / Value store? ...
mehh!
Tags
Map and Reduce
S3...
2i aka Secondary Indexes
aka Tags
object = bucket.get("riak")
object.indexes["level_bin"] = ["awesome"]
object.store
bucket.get_index("level_bin", "awesome")
Map and Reduce
js_func = "function(v){ return [Riak.mapValuesJson(v)[0].message]; }"
Riak::MapReduce.new(client)
.add("brain", "riak")
.map(js_func, :keep => true)
.run
Let's talk S3
Wait what?
Run your own S3 (compatible) backed by Riak
Features
Same API as S3 (use aws-sdk in ruby)
Great reporting facilities
It's your own S3!
Setup
Install Riak
Install RiakCS
Install Stanchion
It's detailed here
... or just setup via Vagrant!
$ vagrant plugin install vagrant-berkshelf
$ vagrant plugin install vagrant-omnibus
$ git clone https://github.com/basho/vagrant-riak-cs-cluster
$ cd vagrant-riak-cs-cluster
$ RIAK_CS_CREATE_ADMIN_USER=1 vagrant up
Virtual setup using vagrant
Create a user
curl -H 'Content-Type: application/json' -X POST 
http://127.0.0.1:8080/riak-cs/user 
--data '{"email":"admin@admin.com", "name":"admin"}'
OK let's try it!
AWS::S3.new({
:access_key_id => "8AA5UQR3EACDS_TIAXLV",
:secret_access_key => "M5eG0q1pN9y6hlc4-JbiCHXLt1YXCY2n7Sb5Yg==",
:use_ssl => false,
:proxy_uri => "http://localhost:8080"
})
Create a bucket
s3bucket = s3.buckets.create("my-bucket", :acl => :public_read)
s3.buckets.map(&:name)
Write something!
obj = s3bucket.objects["riak.jpg"]
obj.write File.read('./images/riak.jpg')
obj.acl = :public_read
s3bucket.objects.map(&:key)
OK lets read it back
This is loaded from local Riak CS
Recap
Distributes Key / Value Store
Easy to interface with
Clients are build of HTTP
Use RiakCS to replace or augment S3
Questions?
Resources
Littleriakbook by Eric Redmond
Basho docs on Racks

Más contenido relacionado

La actualidad más candente

IoT Toolkit and the Smart Object API Tutorial Introduction
IoT Toolkit and the Smart Object API Tutorial IntroductionIoT Toolkit and the Smart Object API Tutorial Introduction
IoT Toolkit and the Smart Object API Tutorial Introduction
Michael Koster
 
Smart objectapi tutorial 092013
Smart objectapi tutorial 092013Smart objectapi tutorial 092013
Smart objectapi tutorial 092013
Michael Koster
 
Share pointtechies linqtosp-andsbs
Share pointtechies linqtosp-andsbsShare pointtechies linqtosp-andsbs
Share pointtechies linqtosp-andsbs
Shakir Majeed Khan
 
Object models for interoperability
Object models for interoperabilityObject models for interoperability
Object models for interoperability
Michael Koster
 

La actualidad más candente (20)

Cloud Custodian
Cloud CustodianCloud Custodian
Cloud Custodian
 
MongoDB.local Berlin: App development in a Serverless World
MongoDB.local Berlin: App development in a Serverless WorldMongoDB.local Berlin: App development in a Serverless World
MongoDB.local Berlin: App development in a Serverless World
 
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and TypescriptMongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
 
IoT Toolkit and the Smart Object API Tutorial Introduction
IoT Toolkit and the Smart Object API Tutorial IntroductionIoT Toolkit and the Smart Object API Tutorial Introduction
IoT Toolkit and the Smart Object API Tutorial Introduction
 
Smart objectapi tutorial 092013
Smart objectapi tutorial 092013Smart objectapi tutorial 092013
Smart objectapi tutorial 092013
 
Share pointtechies linqtosp-andsbs
Share pointtechies linqtosp-andsbsShare pointtechies linqtosp-andsbs
Share pointtechies linqtosp-andsbs
 
Code Camp - Building a Glass app with Wakanda
Code Camp - Building a Glass app with WakandaCode Camp - Building a Glass app with Wakanda
Code Camp - Building a Glass app with Wakanda
 
Storlets fb session_16_9
Storlets fb session_16_9Storlets fb session_16_9
Storlets fb session_16_9
 
Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)
 
Elk
Elk Elk
Elk
 
Android HttpClient - new slide!
Android HttpClient - new slide!Android HttpClient - new slide!
Android HttpClient - new slide!
 
How to write your database: the story about Event Store
How to write your database: the story about Event StoreHow to write your database: the story about Event Store
How to write your database: the story about Event Store
 
Android httpclient php_mysql
Android httpclient php_mysqlAndroid httpclient php_mysql
Android httpclient php_mysql
 
Object models for interoperability
Object models for interoperabilityObject models for interoperability
Object models for interoperability
 
Security monitoring log management-describe logstash,kibana,elastic slidshare
Security monitoring log management-describe logstash,kibana,elastic slidshareSecurity monitoring log management-describe logstash,kibana,elastic slidshare
Security monitoring log management-describe logstash,kibana,elastic slidshare
 
Riga dev day: Lambda architecture at AWS
Riga dev day: Lambda architecture at AWSRiga dev day: Lambda architecture at AWS
Riga dev day: Lambda architecture at AWS
 
Log analysis using Logstash,ElasticSearch and Kibana
Log analysis using Logstash,ElasticSearch and KibanaLog analysis using Logstash,ElasticSearch and Kibana
Log analysis using Logstash,ElasticSearch and Kibana
 
Log management with ELK
Log management with ELKLog management with ELK
Log management with ELK
 
Advance java session 8
Advance java session 8Advance java session 8
Advance java session 8
 
Orion Context Broker
Orion Context Broker Orion Context Broker
Orion Context Broker
 

Similar a PUT Knowledge BUCKET Brain KEY Riak

MapReduce with Scalding @ 24th Hadoop London Meetup
MapReduce with Scalding @ 24th Hadoop London MeetupMapReduce with Scalding @ 24th Hadoop London Meetup
MapReduce with Scalding @ 24th Hadoop London Meetup
Landoop Ltd
 
Apache Spark for Library Developers with Erik Erlandson and William Benton
Apache Spark for Library Developers with Erik Erlandson and William BentonApache Spark for Library Developers with Erik Erlandson and William Benton
Apache Spark for Library Developers with Erik Erlandson and William Benton
Databricks
 
Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web Framework
IndicThreads
 
Scala based Lift Framework
Scala based Lift FrameworkScala based Lift Framework
Scala based Lift Framework
vhazrati
 
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Lucidworks
 
Apache Spark for Library Developers with William Benton and Erik Erlandson
 Apache Spark for Library Developers with William Benton and Erik Erlandson Apache Spark for Library Developers with William Benton and Erik Erlandson
Apache Spark for Library Developers with William Benton and Erik Erlandson
Databricks
 
AWS IoT 핸즈온 워크샵 - 실습 5. DynamoDB에 센서 데이터 저장하기 (김무현 솔루션즈 아키텍트)
AWS IoT 핸즈온 워크샵 - 실습 5. DynamoDB에 센서 데이터 저장하기 (김무현 솔루션즈 아키텍트)AWS IoT 핸즈온 워크샵 - 실습 5. DynamoDB에 센서 데이터 저장하기 (김무현 솔루션즈 아키텍트)
AWS IoT 핸즈온 워크샵 - 실습 5. DynamoDB에 센서 데이터 저장하기 (김무현 솔루션즈 아키텍트)
Amazon Web Services Korea
 

Similar a PUT Knowledge BUCKET Brain KEY Riak (20)

Riak at The NYC Cloud Computing Meetup Group
Riak at The NYC Cloud Computing Meetup GroupRiak at The NYC Cloud Computing Meetup Group
Riak at The NYC Cloud Computing Meetup Group
 
Hugfr SPARK & RIAK -20160114_hug_france
Hugfr  SPARK & RIAK -20160114_hug_franceHugfr  SPARK & RIAK -20160114_hug_france
Hugfr SPARK & RIAK -20160114_hug_france
 
Coding with Riak (from Velocity 2015)
Coding with Riak (from Velocity 2015)Coding with Riak (from Velocity 2015)
Coding with Riak (from Velocity 2015)
 
Riak from Small to Large
Riak from Small to LargeRiak from Small to Large
Riak from Small to Large
 
MapReduce with Scalding @ 24th Hadoop London Meetup
MapReduce with Scalding @ 24th Hadoop London MeetupMapReduce with Scalding @ 24th Hadoop London Meetup
MapReduce with Scalding @ 24th Hadoop London Meetup
 
Apache Spark for Library Developers with Erik Erlandson and William Benton
Apache Spark for Library Developers with Erik Erlandson and William BentonApache Spark for Library Developers with Erik Erlandson and William Benton
Apache Spark for Library Developers with Erik Erlandson and William Benton
 
Riak with Rails
Riak with RailsRiak with Rails
Riak with Rails
 
A Peek At The Future: Going Beyond JavaServer Faces 2.0 With RichFaces 4
A Peek At The Future: Going Beyond JavaServer Faces 2.0 With RichFaces 4A Peek At The Future: Going Beyond JavaServer Faces 2.0 With RichFaces 4
A Peek At The Future: Going Beyond JavaServer Faces 2.0 With RichFaces 4
 
Play!ng with scala
Play!ng with scalaPlay!ng with scala
Play!ng with scala
 
Just one-shade-of-openstack
Just one-shade-of-openstackJust one-shade-of-openstack
Just one-shade-of-openstack
 
Scalding Presentation
Scalding PresentationScalding Presentation
Scalding Presentation
 
Overview Of Lift Framework
Overview Of Lift FrameworkOverview Of Lift Framework
Overview Of Lift Framework
 
Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web Framework
 
Scala based Lift Framework
Scala based Lift FrameworkScala based Lift Framework
Scala based Lift Framework
 
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
 
Apache Spark for Library Developers with William Benton and Erik Erlandson
 Apache Spark for Library Developers with William Benton and Erik Erlandson Apache Spark for Library Developers with William Benton and Erik Erlandson
Apache Spark for Library Developers with William Benton and Erik Erlandson
 
Intro to Rack
Intro to RackIntro to Rack
Intro to Rack
 
Full Stack Scala
Full Stack ScalaFull Stack Scala
Full Stack Scala
 
Spark Sql for Training
Spark Sql for TrainingSpark Sql for Training
Spark Sql for Training
 
AWS IoT 핸즈온 워크샵 - 실습 5. DynamoDB에 센서 데이터 저장하기 (김무현 솔루션즈 아키텍트)
AWS IoT 핸즈온 워크샵 - 실습 5. DynamoDB에 센서 데이터 저장하기 (김무현 솔루션즈 아키텍트)AWS IoT 핸즈온 워크샵 - 실습 5. DynamoDB에 센서 데이터 저장하기 (김무현 솔루션즈 아키텍트)
AWS IoT 핸즈온 워크샵 - 실습 5. DynamoDB에 센서 데이터 저장하기 (김무현 솔루션즈 아키텍트)
 

Más de Philipp Fehre

Node.js and couchbase Full Stack JSON - Munich NoSQL
Node.js and couchbase   Full Stack JSON - Munich NoSQLNode.js and couchbase   Full Stack JSON - Munich NoSQL
Node.js and couchbase Full Stack JSON - Munich NoSQL
Philipp Fehre
 

Más de Philipp Fehre (19)

node.js and native code extensions by example
node.js and native code extensions by examplenode.js and native code extensions by example
node.js and native code extensions by example
 
Jruby a Pi and a database
Jruby a Pi and a databaseJruby a Pi and a database
Jruby a Pi and a database
 
Couchbase Mobile on Android
Couchbase Mobile on AndroidCouchbase Mobile on Android
Couchbase Mobile on Android
 
From 0 to syncing
From 0 to syncingFrom 0 to syncing
From 0 to syncing
 
Node.js and couchbase Full Stack JSON - Munich NoSQL
Node.js and couchbase   Full Stack JSON - Munich NoSQLNode.js and couchbase   Full Stack JSON - Munich NoSQL
Node.js and couchbase Full Stack JSON - Munich NoSQL
 
You got schema in my json
You got schema in my jsonYou got schema in my json
You got schema in my json
 
What is new in Riak 2.0
What is new in Riak 2.0What is new in Riak 2.0
What is new in Riak 2.0
 
Ember background basics
Ember background basicsEmber background basics
Ember background basics
 
Ember learn from Riak Control
Ember learn from Riak ControlEmber learn from Riak Control
Ember learn from Riak Control
 
Testing tdd jasmine
Testing tdd jasmineTesting tdd jasmine
Testing tdd jasmine
 
Testing tdd dom
Testing tdd domTesting tdd dom
Testing tdd dom
 
Something about node basics
Something about node basicsSomething about node basics
Something about node basics
 
A little more advanced node
A little more advanced nodeA little more advanced node
A little more advanced node
 
Something about node in the realworld
Something about node in the realworldSomething about node in the realworld
Something about node in the realworld
 
Riak Intro at Munich Node.js
Riak Intro at Munich Node.jsRiak Intro at Munich Node.js
Riak Intro at Munich Node.js
 
Campfire bot lightning talk
Campfire bot lightning talkCampfire bot lightning talk
Campfire bot lightning talk
 
Lighting fast rails with zeus
Lighting fast rails with zeusLighting fast rails with zeus
Lighting fast rails with zeus
 
JavaScript frontend testing from failure to good to great
JavaScript frontend testing from failure to good to greatJavaScript frontend testing from failure to good to great
JavaScript frontend testing from failure to good to great
 
Network with node
Network with nodeNetwork with node
Network with node
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

PUT Knowledge BUCKET Brain KEY Riak