SlideShare uma empresa Scribd logo
1 de 54
Coding with Riak
by Matt Brender
2
{ "text": ”Hello #VelocityConf!",
"entities": {
"hashtags": [“#VelocityConf”],
"symbols": [],
"urls": [],
"user_mentions": [{
"screen_name": ”mjbrender",
"name": ”Matt Brender",
"id": 4948123,
"id_str": ”42424242",
"indices": [81, 92]
}, {
"screen_name": ”mjbrender",
"name": ”Matt Brender",
"id": 376825877,
"id_str": "376825877",
"indices": [121, 132]
}]
}}
3
git clone
https://github.com/basho-labs
riak-dev
cluster
4
➜ (riak-dev-cluster) rake bootstrap
➜ (riak-dev-cluster) rake member_status
---- Cluster Status ----
Ring ready: true
5
Starting the riak-dev-cluster
for a local dev environment
6
Starting the Riak.app
for a local dev environment
7
Starting the Riak.app
getting search going right away
https://github.com/mjbrender/riak-
app-enable-search
It’s not about NoSQL
8
What we really need..
9
is a database that allows
my app to scale
10
Enter Riak
11
Using Riak
the art of
key/value
12
• Keys – simply binary values
used to identify Objects.*
• Values – can be numbers,
strings, objects, binaries, etc.
• Buckets – used to define a
virtual namespace for storing
Riak objects.
Data Model
Riak stores data as a combination of keys and values in buckets
13
curl http://127.0.0.1:8098/types/places/buckets/country/keys/US
{
"Alpha2_s": "US”,
"Alpha3_s": "USA”,
"EnglishName_s": "United States”,
"NumericCode_i": 840
}
Riak offers both HTTP and Protocol Buffers APIs. The following HTTP
API example uses curl to retrieve a value by key:
Note: Protocol buffers are Google's language-neutral, platform-neutral,
extensible mechanism for serializing structured data – think XML, but
smaller, faster, and simpler.
Data Model
14
There are a diverse group of client libraries for Riak that support both the
HTTP and Protocol Buffer APIs:
Basho Supported Libraries:
• Java
• Ruby
• Python
• PHP
• Erlang
• .NET
• Node.js
Community Libraries:
• C
• Clojure
• Go
• Perl
• Scala
• R
Polylingual
➜ export RIAK_HOST=http://localhost:8098
➜ curl -v $RIAK_HOST/buckets/capitals/keys/usa 
-X PUT 
-H "content-type: text/plain” 
-d "Washington D.C.”
* Trying 127.0.0.1... connected
> PUT /buckets/capitals/keys/usa HTTP/1.1
> Content-Type: text/plain
>
< HTTP/1.1 204 No Content
16
Storing data
Through HTTP
➜ curl $RIAK_HOST/buckets/capitals/keys/usa
Washington D.C.
17
Retrieving data
Through HTTP
➜ curl -v $RIAK_HOST/buckets/capitals/keys/usa
Trying 127.0.0.1... Connected
> GET /buckets/capitals/keys/usa HTTP/1.1
< HTTP/1.1 200 OK
< X-Riak-Vclock:
a85hYGBgzGDKBVIcR4M2cvvL1tzJYEpkzGNluGw/+QRfFgA=
< Vary: Accept-Encoding
< Server: MochiWeb/1.1 WebMachine/1.9.0 (someone had painted it blue)
< Link: </buckets/capitals>; rel="up"
< Last-Modified: Tue, 26 May 2015 14:44:35 GMT
< ETag: "1yAFlUinalK2zNd7LpkOgU”
Washington D.C.
18
Retrieving data
Through HTTP (extended)
➜ gem install riak-client
Successfully installed riak-client-2.1.0
1 gem installed
19
https://github.com/basho/riak-ruby-client
A Simple Ruby App
Starting with the client
>> require 'riak'
=> true
>> client = Riak::Client.new(:pb_port => 8087)
=> #<Riak::Client [#<Node 127.0.0.1:8087>]>
>> client.ping
=> true
20
A Simple Ruby App
That stores and retrieves data
>> default_bucket = client.bucket("default")
=> #<Riak::Bucket {default}>
>> value = default_bucket.new("Monty Python")
=> #<Riak::RObject {default,Monty Python} [#<Riak::RContent
[application/json]:nil>]>
>> value.data = ["Graham Chapman", "Eric Idle", "Terry
Gilliam", "Terry Jones", "John Cleese", "Michael Palin”]
>> value.store()
=> #<Riak::RObject {default,Monty Python} [#<Riak::RContent
[application/json]:["Graham Chapman", "Eric Idle", "Terry Gilliam", "Terry
Jones", "John Cleese", "Michael Palin"]>]>
21
A Simple Ruby App
That stores and retrieves data
>> fetched = default_bucket.get("Monty Python")
=> #<Riak::RObject {default,Monty Python}
[#<Riak::RContent [application/json]:["Graham Chapman",
"Eric Idle", "Terry Gilliam", "Terry Jones", "John Cleese",
"Michael Palin"]>]>
>> fetched.data.to_json
=> "["Graham Chapman","Eric Idle","Terry
Gilliam","Terry Jones","John Cleese","Michael Palin"]"
22
A Simple Ruby App
That stores and retrieves data
Searching
in Riak
➜ riak-2.1.0 cat etc/riak.conf | grep -i search
## this to be set to 'active', including search.
## To enable Search set this 'on'.
search = on
24
Solr will index any field that it recognizes, based
on the index's schema. The default schema
(_yz_default) uses the suffix to decide the field
type (_s represents a string, _i is an integer, _b is
binary and so on).
A Simple Search
Enabling search in Riak
>> client.create_search_index(‘libraries’, ‘_yz_default’)
=> true
>> bucket = client.bucket(‘coding-with-riak’)
=> #<Riak::Bucket {coding-with-riak}>
>> bucket.properties = {‘search_index’ => ‘libraries’}
25
A Simple Search
Enabling search in Riak
Riak stores data as a combination of keys and values in buckets
A SIMPLE SEARCH
Key Value Bucket
ruby {
"name_s" : "Ruby Client",
"maintainer_s" : “Basho",
"popular_b" : true
}
coding-with-riak
go {
"name_s" : "Go Client",
"popular_b" : true,
"maintainer_s" : “Community"
}
coding-with-riak
26
A Simple Search
Using Apache Solr
>> results = client.search("libraries", "maintainer_s:Basho")
=> {"max_score"=>1.8109302520751953, "num_found"=>1,
"docs"=>[{"score"=>"1.81093030000000010382e+00",
"_yz_rb"=>"coding-with-riak", "_yz_rt"=>"default",
"_yz_rk"=>"ruby", "_yz_id"=>"1*default*coding-with-
riak*ruby*57", "name_s"=>"Ruby Client",
"maintainer_s"=>”Basho", "popular_b"=>"true"}]}
27
A Simple Search
Using Apache Solr
>> py = bucket.new("python")
=> #<Riak::RObject {coding-with-riak,python}
[#<Riak::RContent [application/json]:nil>]>
>> py.data = {"name_s"=>"Python Client",
"maintainer_s"=>”Basho", "popular_b"=>true}
=> {"name_s"=>"Python Client",
"maintainer_s"=>”Basho", "popular_b"=>true}
>> py.store
28
A Simple Search
Using Apache Solr
>> results = client.search("libraries", "maintainer_s:Basho")
=> {"max_score"=>1.0, "num_found"=>2,
"docs"=>[{"score"=>"1.00000000000000000000e+00", "_yz_rb"=>"coding-
with-riak", "_yz_rt"=>"default", "_yz_rk"=>"ruby",
"_yz_id"=>"1*default*coding-with-riak*ruby*57", "name_s"=>"Ruby
Client", "maintainer_s"=>"basho", "popular_b"=>"true"},
{"score"=>"1.00000000000000000000e+00", "_yz_rb"=>"coding-with-riak",
"_yz_rt"=>"default", "_yz_rk"=>"python", "_yz_id"=>"1*default*coding-
with-riak*python*48", "name_s"=>"Python Client",
"maintainer_s"=>"basho", "popular_b"=>"true"}]}
29
A Simple Search
Using Apache Solr
>> results["docs"].each {|x| puts x["name_s"]}
Ruby Client
Python Client
>> results["docs"].each {|x| puts x["name_s"] + "," +
x["maintainer_s"]}
Ruby Client,Basho
Python Client,Basho
Basho Confidential 30
A Simple Search
Using Apache Solr
31
• Apache Solr full-
text search
• Support for Solr’s
client query APIs
• Tag objects with
one or more query
values
• Index integers or
strings
• Exact matches or
ranges of values
• Filter documents
by tag
• Count words in
documents
• Extract links to
related data
Riak Search
Secondary
Indexes
MapReduce
Search in Riak
choose your own language
Developing for Riak
32
Coding
Considerations
33
34
Client
DBRiak
35
Client
DBRiak
http://www.slideshare.net/dkrotkine/slides-wide
Fear the
multi-write
36
37
IMAGE FROM IPAD
Write availability
38
IMAGE FROM IPAD
Messaging Queue
(highlight Dynamiq/RabbitMQ)
39
40
MONITORING
The choice is
yours
41
A multitude of stats is available through riak-admin or HTTP
Calculations
Basic Stats:
• CPU (user/system/wait/idle)
• Processor Load
• Available Memory
• Available disk space
• Used file descriptors
• Swap Usage
• IOWait
• Read operations
• Write operations
• Network throughput
• Network errors
Exploring Latency:
• FSM Time Stats represent
the amount of time in
microseconds required to
traverse the GET or PUT
Finite State Machine code,
offering a picture of general
node health.
The most common way to analyze Riak is through your favorite interface
Tools
Basho Tested:
• Zabbix
• Nagios
• New Relic
Community Libraries:
• OpenTSDB
• Ganglia
• collectd
IN REVIEW
from one to many
Scaling Up
From laptop to cluster
without changing settings
45
from one to many
Scaling Up
From laptop to cluster
without changing settings
46
^ code
here’s where it gets.. easy?
Scaling Up
$ dev2/bin/riak-admin cluster join dev1@127.0.0.1
$ dev3/bin/riak-admin cluster join dev1@127.0.0.1
$ dev4/bin/riak-admin cluster join dev1@127.0.0.1
$ dev5/bin/riak-admin cluster join dev1@127.0.0.1
Just add a machine
Biggest change for dev:
reads
48
49
Biggest change for ops:
administration
50
Cost of Downtime
What you will gain
51
More flexible, fluid designs
More natural data representations
Scaling without pain
Reduced operational complexity
Application Type Key Value
Session User/Session ID Session Data
Advertising Campaign ID Ad Content
Logs Date Log File
Sensor Date, Date/Time Sensor Updates
User Data Login, email, UUID User Attributes
Content Title, Integer Text,
JSON/XML/HTTP
document, images,
Riak Use Cases
RIAK DEPLOYED
WORLDWIDE
getting to know us
Spend Time
github.com/basho-labs
&
docs.basho.com
@mjbrender

Mais conteúdo relacionado

Mais procurados

ELK Ruminating on Logs (Zendcon 2016)
ELK Ruminating on Logs (Zendcon 2016)ELK Ruminating on Logs (Zendcon 2016)
ELK Ruminating on Logs (Zendcon 2016)Mathew Beane
 
Mobile Analytics mit Elasticsearch und Kibana
Mobile Analytics mit Elasticsearch und KibanaMobile Analytics mit Elasticsearch und Kibana
Mobile Analytics mit Elasticsearch und Kibanainovex GmbH
 
Spark zeppelin-cassandra at synchrotron
Spark zeppelin-cassandra at synchrotronSpark zeppelin-cassandra at synchrotron
Spark zeppelin-cassandra at synchrotronDuyhai Doan
 
Open Source Logging and Monitoring Tools
Open Source Logging and Monitoring ToolsOpen Source Logging and Monitoring Tools
Open Source Logging and Monitoring ToolsPhase2
 
Logging logs with Logstash - Devops MK 10-02-2016
Logging logs with Logstash - Devops MK 10-02-2016Logging logs with Logstash - Devops MK 10-02-2016
Logging logs with Logstash - Devops MK 10-02-2016Steve Howe
 
Harnessing the power of Nutch with Scala
Harnessing the power of Nutch with ScalaHarnessing the power of Nutch with Scala
Harnessing the power of Nutch with ScalaKnoldus Inc.
 
Big data analytics with Spark & Cassandra
Big data analytics with Spark & Cassandra Big data analytics with Spark & Cassandra
Big data analytics with Spark & Cassandra Matthias Niehoff
 
Spark Cassandra Connector: Past, Present, and Future
Spark Cassandra Connector: Past, Present, and FutureSpark Cassandra Connector: Past, Present, and Future
Spark Cassandra Connector: Past, Present, and FutureRussell Spitzer
 
Apache Spark and DataStax Enablement
Apache Spark and DataStax EnablementApache Spark and DataStax Enablement
Apache Spark and DataStax EnablementVincent Poncet
 
Spark and Cassandra 2 Fast 2 Furious
Spark and Cassandra 2 Fast 2 FuriousSpark and Cassandra 2 Fast 2 Furious
Spark and Cassandra 2 Fast 2 FuriousRussell Spitzer
 
Analyzing Log Data With Apache Spark
Analyzing Log Data With Apache SparkAnalyzing Log Data With Apache Spark
Analyzing Log Data With Apache SparkSpark Summit
 
Case study of Rujhaan.com (A social news app )
Case study of Rujhaan.com (A social news app )Case study of Rujhaan.com (A social news app )
Case study of Rujhaan.com (A social news app )Rahul Jain
 
Shipping & Visualize Your Data With ELK
Shipping  & Visualize Your Data With ELKShipping  & Visualize Your Data With ELK
Shipping & Visualize Your Data With ELKAdam Chen
 
Apache Drill and Zeppelin: Two Promising Tools You've Never Heard Of
Apache Drill and Zeppelin: Two Promising Tools You've Never Heard OfApache Drill and Zeppelin: Two Promising Tools You've Never Heard Of
Apache Drill and Zeppelin: Two Promising Tools You've Never Heard OfCharles Givre
 
Analytics with Cassandra & Spark
Analytics with Cassandra & SparkAnalytics with Cassandra & Spark
Analytics with Cassandra & SparkMatthias Niehoff
 
Introduction to real time big data with Apache Spark
Introduction to real time big data with Apache SparkIntroduction to real time big data with Apache Spark
Introduction to real time big data with Apache SparkTaras Matyashovsky
 
(Big) Data Serialization with Avro and Protobuf
(Big) Data Serialization with Avro and Protobuf(Big) Data Serialization with Avro and Protobuf
(Big) Data Serialization with Avro and ProtobufGuido Schmutz
 

Mais procurados (20)

Giraph+Gora in ApacheCon14
Giraph+Gora in ApacheCon14Giraph+Gora in ApacheCon14
Giraph+Gora in ApacheCon14
 
ELK Ruminating on Logs (Zendcon 2016)
ELK Ruminating on Logs (Zendcon 2016)ELK Ruminating on Logs (Zendcon 2016)
ELK Ruminating on Logs (Zendcon 2016)
 
Os riak1-pdf
Os riak1-pdfOs riak1-pdf
Os riak1-pdf
 
Mobile Analytics mit Elasticsearch und Kibana
Mobile Analytics mit Elasticsearch und KibanaMobile Analytics mit Elasticsearch und Kibana
Mobile Analytics mit Elasticsearch und Kibana
 
Spark zeppelin-cassandra at synchrotron
Spark zeppelin-cassandra at synchrotronSpark zeppelin-cassandra at synchrotron
Spark zeppelin-cassandra at synchrotron
 
Open Source Logging and Monitoring Tools
Open Source Logging and Monitoring ToolsOpen Source Logging and Monitoring Tools
Open Source Logging and Monitoring Tools
 
Logging logs with Logstash - Devops MK 10-02-2016
Logging logs with Logstash - Devops MK 10-02-2016Logging logs with Logstash - Devops MK 10-02-2016
Logging logs with Logstash - Devops MK 10-02-2016
 
Harnessing the power of Nutch with Scala
Harnessing the power of Nutch with ScalaHarnessing the power of Nutch with Scala
Harnessing the power of Nutch with Scala
 
Big data analytics with Spark & Cassandra
Big data analytics with Spark & Cassandra Big data analytics with Spark & Cassandra
Big data analytics with Spark & Cassandra
 
Spark Cassandra Connector: Past, Present, and Future
Spark Cassandra Connector: Past, Present, and FutureSpark Cassandra Connector: Past, Present, and Future
Spark Cassandra Connector: Past, Present, and Future
 
Apache Spark and DataStax Enablement
Apache Spark and DataStax EnablementApache Spark and DataStax Enablement
Apache Spark and DataStax Enablement
 
Spark and Cassandra 2 Fast 2 Furious
Spark and Cassandra 2 Fast 2 FuriousSpark and Cassandra 2 Fast 2 Furious
Spark and Cassandra 2 Fast 2 Furious
 
Analyzing Log Data With Apache Spark
Analyzing Log Data With Apache SparkAnalyzing Log Data With Apache Spark
Analyzing Log Data With Apache Spark
 
Case study of Rujhaan.com (A social news app )
Case study of Rujhaan.com (A social news app )Case study of Rujhaan.com (A social news app )
Case study of Rujhaan.com (A social news app )
 
Shipping & Visualize Your Data With ELK
Shipping  & Visualize Your Data With ELKShipping  & Visualize Your Data With ELK
Shipping & Visualize Your Data With ELK
 
Apache Drill and Zeppelin: Two Promising Tools You've Never Heard Of
Apache Drill and Zeppelin: Two Promising Tools You've Never Heard OfApache Drill and Zeppelin: Two Promising Tools You've Never Heard Of
Apache Drill and Zeppelin: Two Promising Tools You've Never Heard Of
 
Analytics with Cassandra & Spark
Analytics with Cassandra & SparkAnalytics with Cassandra & Spark
Analytics with Cassandra & Spark
 
Debugging Apache Spark
Debugging Apache SparkDebugging Apache Spark
Debugging Apache Spark
 
Introduction to real time big data with Apache Spark
Introduction to real time big data with Apache SparkIntroduction to real time big data with Apache Spark
Introduction to real time big data with Apache Spark
 
(Big) Data Serialization with Avro and Protobuf
(Big) Data Serialization with Avro and Protobuf(Big) Data Serialization with Avro and Protobuf
(Big) Data Serialization with Avro and Protobuf
 

Destaque

Schema Design for Riak
Schema Design for RiakSchema Design for Riak
Schema Design for RiakSean Cribbs
 
Data visualization
Data visualizationData visualization
Data visualizationMukul Taneja
 
NoSQL – Beyond the Key-Value Store
NoSQL – Beyond the Key-Value StoreNoSQL – Beyond the Key-Value Store
NoSQL – Beyond the Key-Value StoreDATAVERSITY
 
Riak Operations
Riak OperationsRiak Operations
Riak Operationsgschofield
 
Key-Value Stores: a practical overview
Key-Value Stores: a practical overviewKey-Value Stores: a practical overview
Key-Value Stores: a practical overviewMarc Seeger
 
Riak: A friendly key/value store for the web.
Riak: A friendly key/value store for the web.Riak: A friendly key/value store for the web.
Riak: A friendly key/value store for the web.codefluency
 
Microsoft Modern Analytics
Microsoft Modern AnalyticsMicrosoft Modern Analytics
Microsoft Modern AnalyticsMSDEVMTL
 
Modern Data Warehousing with the Microsoft Analytics Platform System
Modern Data Warehousing with the Microsoft Analytics Platform SystemModern Data Warehousing with the Microsoft Analytics Platform System
Modern Data Warehousing with the Microsoft Analytics Platform SystemJames Serra
 
Tableau Software - Business Analytics and Data Visualization
Tableau Software - Business Analytics and Data VisualizationTableau Software - Business Analytics and Data Visualization
Tableau Software - Business Analytics and Data Visualizationlesterathayde
 
Everything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askEverything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askCarlos Abalde
 
Tableau presentation
Tableau presentationTableau presentation
Tableau presentationkt166212
 

Destaque (11)

Schema Design for Riak
Schema Design for RiakSchema Design for Riak
Schema Design for Riak
 
Data visualization
Data visualizationData visualization
Data visualization
 
NoSQL – Beyond the Key-Value Store
NoSQL – Beyond the Key-Value StoreNoSQL – Beyond the Key-Value Store
NoSQL – Beyond the Key-Value Store
 
Riak Operations
Riak OperationsRiak Operations
Riak Operations
 
Key-Value Stores: a practical overview
Key-Value Stores: a practical overviewKey-Value Stores: a practical overview
Key-Value Stores: a practical overview
 
Riak: A friendly key/value store for the web.
Riak: A friendly key/value store for the web.Riak: A friendly key/value store for the web.
Riak: A friendly key/value store for the web.
 
Microsoft Modern Analytics
Microsoft Modern AnalyticsMicrosoft Modern Analytics
Microsoft Modern Analytics
 
Modern Data Warehousing with the Microsoft Analytics Platform System
Modern Data Warehousing with the Microsoft Analytics Platform SystemModern Data Warehousing with the Microsoft Analytics Platform System
Modern Data Warehousing with the Microsoft Analytics Platform System
 
Tableau Software - Business Analytics and Data Visualization
Tableau Software - Business Analytics and Data VisualizationTableau Software - Business Analytics and Data Visualization
Tableau Software - Business Analytics and Data Visualization
 
Everything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askEverything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to ask
 
Tableau presentation
Tableau presentationTableau presentation
Tableau presentation
 

Semelhante a Coding with Riak (from Velocity 2015)

Couchdb: No SQL? No driver? No problem
Couchdb: No SQL? No driver? No problemCouchdb: No SQL? No driver? No problem
Couchdb: No SQL? No driver? No problemdelagoya
 
Spark Sql for Training
Spark Sql for TrainingSpark Sql for Training
Spark Sql for TrainingBryan Yang
 
PUT Knowledge BUCKET Brain KEY Riak
PUT Knowledge BUCKET Brain KEY RiakPUT Knowledge BUCKET Brain KEY Riak
PUT Knowledge BUCKET Brain KEY RiakPhilipp Fehre
 
Managing Your Security Logs with Elasticsearch
Managing Your Security Logs with ElasticsearchManaging Your Security Logs with Elasticsearch
Managing Your Security Logs with ElasticsearchVic Hargrave
 
Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19confluent
 
Big Data Solutions in Azure - David Giard
Big Data Solutions in Azure - David GiardBig Data Solutions in Azure - David Giard
Big Data Solutions in Azure - David GiardITCamp
 
Riak from Small to Large
Riak from Small to LargeRiak from Small to Large
Riak from Small to LargeRusty Klophaus
 
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 Groupsiculars
 
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...Ivanti
 
Redispresentation apac2012
Redispresentation apac2012Redispresentation apac2012
Redispresentation apac2012Ankur Gupta
 
AWS IoT 핸즈온 워크샵 - 실습 5. DynamoDB에 센서 데이터 저장하기 (김무현 솔루션즈 아키텍트)
AWS IoT 핸즈온 워크샵 - 실습 5. DynamoDB에 센서 데이터 저장하기 (김무현 솔루션즈 아키텍트)AWS IoT 핸즈온 워크샵 - 실습 5. DynamoDB에 센서 데이터 저장하기 (김무현 솔루션즈 아키텍트)
AWS IoT 핸즈온 워크샵 - 실습 5. DynamoDB에 센서 데이터 저장하기 (김무현 솔루션즈 아키텍트)Amazon Web Services Korea
 
How sitecore depends on mongo db for scalability and performance, and what it...
How sitecore depends on mongo db for scalability and performance, and what it...How sitecore depends on mongo db for scalability and performance, and what it...
How sitecore depends on mongo db for scalability and performance, and what it...Antonios Giannopoulos
 
PuppetDB: A Single Source for Storing Your Puppet Data - PUG NY
PuppetDB: A Single Source for Storing Your Puppet Data - PUG NYPuppetDB: A Single Source for Storing Your Puppet Data - PUG NY
PuppetDB: A Single Source for Storing Your Puppet Data - PUG NYPuppet
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCLFastly
 
Adding Riak to your NoSQL Bag of Tricks
Adding Riak to your NoSQL Bag of TricksAdding Riak to your NoSQL Bag of Tricks
Adding Riak to your NoSQL Bag of Trickssiculars
 
What is the ServiceStack?
What is the ServiceStack?What is the ServiceStack?
What is the ServiceStack?Demis Bellot
 

Semelhante a Coding with Riak (from Velocity 2015) (20)

Couchdb: No SQL? No driver? No problem
Couchdb: No SQL? No driver? No problemCouchdb: No SQL? No driver? No problem
Couchdb: No SQL? No driver? No problem
 
Spark Sql for Training
Spark Sql for TrainingSpark Sql for Training
Spark Sql for Training
 
PUT Knowledge BUCKET Brain KEY Riak
PUT Knowledge BUCKET Brain KEY RiakPUT Knowledge BUCKET Brain KEY Riak
PUT Knowledge BUCKET Brain KEY Riak
 
ql.io at NodePDX
ql.io at NodePDXql.io at NodePDX
ql.io at NodePDX
 
Managing Your Security Logs with Elasticsearch
Managing Your Security Logs with ElasticsearchManaging Your Security Logs with Elasticsearch
Managing Your Security Logs with Elasticsearch
 
Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19
 
Big Data Solutions in Azure - David Giard
Big Data Solutions in Azure - David GiardBig Data Solutions in Azure - David Giard
Big Data Solutions in Azure - David Giard
 
Rack
RackRack
Rack
 
Excelian hyperledger walkthrough-feb17
Excelian hyperledger walkthrough-feb17Excelian hyperledger walkthrough-feb17
Excelian hyperledger walkthrough-feb17
 
Riak from Small to Large
Riak from Small to LargeRiak from Small to Large
Riak from Small to Large
 
MongoDB FabLab León
MongoDB FabLab LeónMongoDB FabLab León
MongoDB FabLab León
 
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
 
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
 
Redispresentation apac2012
Redispresentation apac2012Redispresentation apac2012
Redispresentation apac2012
 
AWS IoT 핸즈온 워크샵 - 실습 5. DynamoDB에 센서 데이터 저장하기 (김무현 솔루션즈 아키텍트)
AWS IoT 핸즈온 워크샵 - 실습 5. DynamoDB에 센서 데이터 저장하기 (김무현 솔루션즈 아키텍트)AWS IoT 핸즈온 워크샵 - 실습 5. DynamoDB에 센서 데이터 저장하기 (김무현 솔루션즈 아키텍트)
AWS IoT 핸즈온 워크샵 - 실습 5. DynamoDB에 센서 데이터 저장하기 (김무현 솔루션즈 아키텍트)
 
How sitecore depends on mongo db for scalability and performance, and what it...
How sitecore depends on mongo db for scalability and performance, and what it...How sitecore depends on mongo db for scalability and performance, and what it...
How sitecore depends on mongo db for scalability and performance, and what it...
 
PuppetDB: A Single Source for Storing Your Puppet Data - PUG NY
PuppetDB: A Single Source for Storing Your Puppet Data - PUG NYPuppetDB: A Single Source for Storing Your Puppet Data - PUG NY
PuppetDB: A Single Source for Storing Your Puppet Data - PUG NY
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCL
 
Adding Riak to your NoSQL Bag of Tricks
Adding Riak to your NoSQL Bag of TricksAdding Riak to your NoSQL Bag of Tricks
Adding Riak to your NoSQL Bag of Tricks
 
What is the ServiceStack?
What is the ServiceStack?What is the ServiceStack?
What is the ServiceStack?
 

Mais de Basho Technologies

Data Modeling IoT and Time Series data in NoSQL
Data Modeling IoT and Time Series data in NoSQLData Modeling IoT and Time Series data in NoSQL
Data Modeling IoT and Time Series data in NoSQLBasho Technologies
 
A Zen Journey to Database Management
A Zen Journey to Database ManagementA Zen Journey to Database Management
A Zen Journey to Database ManagementBasho Technologies
 
Vagrant up a Distributed Test Environment - Nginx Summit 2015
Vagrant up a Distributed Test Environment - Nginx Summit 2015Vagrant up a Distributed Test Environment - Nginx Summit 2015
Vagrant up a Distributed Test Environment - Nginx Summit 2015Basho Technologies
 
O'Reilly Webinar: Simplicity Scales - Big Data
O'Reilly Webinar: Simplicity Scales - Big Data O'Reilly Webinar: Simplicity Scales - Big Data
O'Reilly Webinar: Simplicity Scales - Big Data Basho Technologies
 
A little about Message Queues - Boston Riak Meetup
A little about Message Queues - Boston Riak MeetupA little about Message Queues - Boston Riak Meetup
A little about Message Queues - Boston Riak MeetupBasho Technologies
 
NoSQL Implementation - Part 1 (Velocity 2015)
NoSQL Implementation - Part 1 (Velocity 2015)NoSQL Implementation - Part 1 (Velocity 2015)
NoSQL Implementation - Part 1 (Velocity 2015)Basho Technologies
 
Basho and Riak at GOTO Stockholm: "Don't Use My Database."
Basho and Riak at GOTO Stockholm:  "Don't Use My Database."Basho and Riak at GOTO Stockholm:  "Don't Use My Database."
Basho and Riak at GOTO Stockholm: "Don't Use My Database."Basho Technologies
 
Using Basho Bench to Load Test Distributed Applications
Using Basho Bench to Load Test Distributed ApplicationsUsing Basho Bench to Load Test Distributed Applications
Using Basho Bench to Load Test Distributed ApplicationsBasho Technologies
 

Mais de Basho Technologies (10)

Data Modeling IoT and Time Series data in NoSQL
Data Modeling IoT and Time Series data in NoSQLData Modeling IoT and Time Series data in NoSQL
Data Modeling IoT and Time Series data in NoSQL
 
A Zen Journey to Database Management
A Zen Journey to Database ManagementA Zen Journey to Database Management
A Zen Journey to Database Management
 
Vagrant up a Distributed Test Environment - Nginx Summit 2015
Vagrant up a Distributed Test Environment - Nginx Summit 2015Vagrant up a Distributed Test Environment - Nginx Summit 2015
Vagrant up a Distributed Test Environment - Nginx Summit 2015
 
O'Reilly Webinar: Simplicity Scales - Big Data
O'Reilly Webinar: Simplicity Scales - Big Data O'Reilly Webinar: Simplicity Scales - Big Data
O'Reilly Webinar: Simplicity Scales - Big Data
 
A little about Message Queues - Boston Riak Meetup
A little about Message Queues - Boston Riak MeetupA little about Message Queues - Boston Riak Meetup
A little about Message Queues - Boston Riak Meetup
 
tecFinal 451 webinar deck
tecFinal 451 webinar decktecFinal 451 webinar deck
tecFinal 451 webinar deck
 
NoSQL Implementation - Part 1 (Velocity 2015)
NoSQL Implementation - Part 1 (Velocity 2015)NoSQL Implementation - Part 1 (Velocity 2015)
NoSQL Implementation - Part 1 (Velocity 2015)
 
Taming Big Data with NoSQL
Taming Big Data with NoSQLTaming Big Data with NoSQL
Taming Big Data with NoSQL
 
Basho and Riak at GOTO Stockholm: "Don't Use My Database."
Basho and Riak at GOTO Stockholm:  "Don't Use My Database."Basho and Riak at GOTO Stockholm:  "Don't Use My Database."
Basho and Riak at GOTO Stockholm: "Don't Use My Database."
 
Using Basho Bench to Load Test Distributed Applications
Using Basho Bench to Load Test Distributed ApplicationsUsing Basho Bench to Load Test Distributed Applications
Using Basho Bench to Load Test Distributed Applications
 

Último

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
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.pptxHampshireHUG
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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 textsMaria Levchenko
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Último (20)

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
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
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Coding with Riak (from Velocity 2015)

  • 1. Coding with Riak by Matt Brender
  • 2. 2 { "text": ”Hello #VelocityConf!", "entities": { "hashtags": [“#VelocityConf”], "symbols": [], "urls": [], "user_mentions": [{ "screen_name": ”mjbrender", "name": ”Matt Brender", "id": 4948123, "id_str": ”42424242", "indices": [81, 92] }, { "screen_name": ”mjbrender", "name": ”Matt Brender", "id": 376825877, "id_str": "376825877", "indices": [121, 132] }] }}
  • 3. 3
  • 5. ➜ (riak-dev-cluster) rake bootstrap ➜ (riak-dev-cluster) rake member_status ---- Cluster Status ---- Ring ready: true 5 Starting the riak-dev-cluster for a local dev environment
  • 6. 6 Starting the Riak.app for a local dev environment
  • 7. 7 Starting the Riak.app getting search going right away https://github.com/mjbrender/riak- app-enable-search
  • 9. What we really need.. 9
  • 10. is a database that allows my app to scale 10
  • 12. Using Riak the art of key/value 12
  • 13. • Keys – simply binary values used to identify Objects.* • Values – can be numbers, strings, objects, binaries, etc. • Buckets – used to define a virtual namespace for storing Riak objects. Data Model Riak stores data as a combination of keys and values in buckets 13
  • 14. curl http://127.0.0.1:8098/types/places/buckets/country/keys/US { "Alpha2_s": "US”, "Alpha3_s": "USA”, "EnglishName_s": "United States”, "NumericCode_i": 840 } Riak offers both HTTP and Protocol Buffers APIs. The following HTTP API example uses curl to retrieve a value by key: Note: Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler. Data Model 14
  • 15. There are a diverse group of client libraries for Riak that support both the HTTP and Protocol Buffer APIs: Basho Supported Libraries: • Java • Ruby • Python • PHP • Erlang • .NET • Node.js Community Libraries: • C • Clojure • Go • Perl • Scala • R Polylingual
  • 16. ➜ export RIAK_HOST=http://localhost:8098 ➜ curl -v $RIAK_HOST/buckets/capitals/keys/usa -X PUT -H "content-type: text/plain” -d "Washington D.C.” * Trying 127.0.0.1... connected > PUT /buckets/capitals/keys/usa HTTP/1.1 > Content-Type: text/plain > < HTTP/1.1 204 No Content 16 Storing data Through HTTP
  • 17. ➜ curl $RIAK_HOST/buckets/capitals/keys/usa Washington D.C. 17 Retrieving data Through HTTP
  • 18. ➜ curl -v $RIAK_HOST/buckets/capitals/keys/usa Trying 127.0.0.1... Connected > GET /buckets/capitals/keys/usa HTTP/1.1 < HTTP/1.1 200 OK < X-Riak-Vclock: a85hYGBgzGDKBVIcR4M2cvvL1tzJYEpkzGNluGw/+QRfFgA= < Vary: Accept-Encoding < Server: MochiWeb/1.1 WebMachine/1.9.0 (someone had painted it blue) < Link: </buckets/capitals>; rel="up" < Last-Modified: Tue, 26 May 2015 14:44:35 GMT < ETag: "1yAFlUinalK2zNd7LpkOgU” Washington D.C. 18 Retrieving data Through HTTP (extended)
  • 19. ➜ gem install riak-client Successfully installed riak-client-2.1.0 1 gem installed 19 https://github.com/basho/riak-ruby-client A Simple Ruby App Starting with the client
  • 20. >> require 'riak' => true >> client = Riak::Client.new(:pb_port => 8087) => #<Riak::Client [#<Node 127.0.0.1:8087>]> >> client.ping => true 20 A Simple Ruby App That stores and retrieves data
  • 21. >> default_bucket = client.bucket("default") => #<Riak::Bucket {default}> >> value = default_bucket.new("Monty Python") => #<Riak::RObject {default,Monty Python} [#<Riak::RContent [application/json]:nil>]> >> value.data = ["Graham Chapman", "Eric Idle", "Terry Gilliam", "Terry Jones", "John Cleese", "Michael Palin”] >> value.store() => #<Riak::RObject {default,Monty Python} [#<Riak::RContent [application/json]:["Graham Chapman", "Eric Idle", "Terry Gilliam", "Terry Jones", "John Cleese", "Michael Palin"]>]> 21 A Simple Ruby App That stores and retrieves data
  • 22. >> fetched = default_bucket.get("Monty Python") => #<Riak::RObject {default,Monty Python} [#<Riak::RContent [application/json]:["Graham Chapman", "Eric Idle", "Terry Gilliam", "Terry Jones", "John Cleese", "Michael Palin"]>]> >> fetched.data.to_json => "["Graham Chapman","Eric Idle","Terry Gilliam","Terry Jones","John Cleese","Michael Palin"]" 22 A Simple Ruby App That stores and retrieves data
  • 24. ➜ riak-2.1.0 cat etc/riak.conf | grep -i search ## this to be set to 'active', including search. ## To enable Search set this 'on'. search = on 24 Solr will index any field that it recognizes, based on the index's schema. The default schema (_yz_default) uses the suffix to decide the field type (_s represents a string, _i is an integer, _b is binary and so on). A Simple Search Enabling search in Riak
  • 25. >> client.create_search_index(‘libraries’, ‘_yz_default’) => true >> bucket = client.bucket(‘coding-with-riak’) => #<Riak::Bucket {coding-with-riak}> >> bucket.properties = {‘search_index’ => ‘libraries’} 25 A Simple Search Enabling search in Riak
  • 26. Riak stores data as a combination of keys and values in buckets A SIMPLE SEARCH Key Value Bucket ruby { "name_s" : "Ruby Client", "maintainer_s" : “Basho", "popular_b" : true } coding-with-riak go { "name_s" : "Go Client", "popular_b" : true, "maintainer_s" : “Community" } coding-with-riak 26 A Simple Search Using Apache Solr
  • 27. >> results = client.search("libraries", "maintainer_s:Basho") => {"max_score"=>1.8109302520751953, "num_found"=>1, "docs"=>[{"score"=>"1.81093030000000010382e+00", "_yz_rb"=>"coding-with-riak", "_yz_rt"=>"default", "_yz_rk"=>"ruby", "_yz_id"=>"1*default*coding-with- riak*ruby*57", "name_s"=>"Ruby Client", "maintainer_s"=>”Basho", "popular_b"=>"true"}]} 27 A Simple Search Using Apache Solr
  • 28. >> py = bucket.new("python") => #<Riak::RObject {coding-with-riak,python} [#<Riak::RContent [application/json]:nil>]> >> py.data = {"name_s"=>"Python Client", "maintainer_s"=>”Basho", "popular_b"=>true} => {"name_s"=>"Python Client", "maintainer_s"=>”Basho", "popular_b"=>true} >> py.store 28 A Simple Search Using Apache Solr
  • 29. >> results = client.search("libraries", "maintainer_s:Basho") => {"max_score"=>1.0, "num_found"=>2, "docs"=>[{"score"=>"1.00000000000000000000e+00", "_yz_rb"=>"coding- with-riak", "_yz_rt"=>"default", "_yz_rk"=>"ruby", "_yz_id"=>"1*default*coding-with-riak*ruby*57", "name_s"=>"Ruby Client", "maintainer_s"=>"basho", "popular_b"=>"true"}, {"score"=>"1.00000000000000000000e+00", "_yz_rb"=>"coding-with-riak", "_yz_rt"=>"default", "_yz_rk"=>"python", "_yz_id"=>"1*default*coding- with-riak*python*48", "name_s"=>"Python Client", "maintainer_s"=>"basho", "popular_b"=>"true"}]} 29 A Simple Search Using Apache Solr
  • 30. >> results["docs"].each {|x| puts x["name_s"]} Ruby Client Python Client >> results["docs"].each {|x| puts x["name_s"] + "," + x["maintainer_s"]} Ruby Client,Basho Python Client,Basho Basho Confidential 30 A Simple Search Using Apache Solr
  • 31. 31 • Apache Solr full- text search • Support for Solr’s client query APIs • Tag objects with one or more query values • Index integers or strings • Exact matches or ranges of values • Filter documents by tag • Count words in documents • Extract links to related data Riak Search Secondary Indexes MapReduce Search in Riak
  • 32. choose your own language Developing for Riak 32
  • 37. 37
  • 38. IMAGE FROM IPAD Write availability 38
  • 39. IMAGE FROM IPAD Messaging Queue (highlight Dynamiq/RabbitMQ) 39
  • 40. 40
  • 42. A multitude of stats is available through riak-admin or HTTP Calculations Basic Stats: • CPU (user/system/wait/idle) • Processor Load • Available Memory • Available disk space • Used file descriptors • Swap Usage • IOWait • Read operations • Write operations • Network throughput • Network errors Exploring Latency: • FSM Time Stats represent the amount of time in microseconds required to traverse the GET or PUT Finite State Machine code, offering a picture of general node health.
  • 43. The most common way to analyze Riak is through your favorite interface Tools Basho Tested: • Zabbix • Nagios • New Relic Community Libraries: • OpenTSDB • Ganglia • collectd
  • 45. from one to many Scaling Up From laptop to cluster without changing settings 45
  • 46. from one to many Scaling Up From laptop to cluster without changing settings 46 ^ code
  • 47. here’s where it gets.. easy? Scaling Up $ dev2/bin/riak-admin cluster join dev1@127.0.0.1 $ dev3/bin/riak-admin cluster join dev1@127.0.0.1 $ dev4/bin/riak-admin cluster join dev1@127.0.0.1 $ dev5/bin/riak-admin cluster join dev1@127.0.0.1 Just add a machine
  • 48. Biggest change for dev: reads 48
  • 49. 49 Biggest change for ops: administration
  • 51. What you will gain 51 More flexible, fluid designs More natural data representations Scaling without pain Reduced operational complexity
  • 52. Application Type Key Value Session User/Session ID Session Data Advertising Campaign ID Ad Content Logs Date Log File Sensor Date, Date/Time Sensor Updates User Data Login, email, UUID User Attributes Content Title, Integer Text, JSON/XML/HTTP document, images, Riak Use Cases
  • 54. getting to know us Spend Time github.com/basho-labs & docs.basho.com @mjbrender