SlideShare ist ein Scribd-Unternehmen logo
1 von 38
Downloaden Sie, um offline zu lesen
RIAK 2.0 
Engin Yöyen 
October, 2014
What is Riak 
• Key/Value Store 
• hashTable[‘D018319’] = ‘Influenza’ 
• diseases = hashTable[‘D018319’]
Buckets 
• There is no global namespace. 
• All keys must belong to a bucket. 
• diseases[‘D018319’] = ‘Influenza’ 
• symptoms[‘D018319’] = ‘cervical pains’
Why Bucket Types 
• diseases[‘infectious’][‘D018319’] = ‘Influenza’ 
• diseases[‘blood-borne’][‘F023831’] = ‘Hepatitis B’ 
• Groups of buckets with a similar set of properties. 
• diseases.props = {"search_index":"anyplace"}
The API
The API 
via HTTP methods PUT, GET, POST, DELETE 
Example 
[hostAddress]/types/<type>/buckets/<bucket>/keys/<key>
PUT 
curl -XPUT "http://localhost:8098/types/diseases/buckets/ 
infectious/keys/D018319"  
-H "Content-Type:text/plain"  
-d "Influenza, commonly known as, the flu, ...." 
riak-admin bucket-type create diseases '{"props": 
{"datatype":"set"}}' 
riak-admin bucket-type activate diseases
PUT (2) 
curl -v -XPUT "http://localhost:8098/types/diseases/buckets/ 
infectious/keys/D018319"  
-H "Content-Type: application/json"  
-d '{"desc": "Influenza, commonly known as, the flu, …."}' 
Hint : http://localhost:8098/types/diseases/buckets/infectious/keys/D018319?returnbody=true
GET 
http://localhost:8098/types/diseases/buckets/infectious/keys/ 
D018319
Post 
http://localhost:8098/types/diseases/buckets/infectious/keys
Delete 
I am sure you all figured out by now….
Hints
Hints - Buckets 
http://localhost:8098/types/diseases/buckets?buckets=true 
{ 
"buckets": [ 
"blood-borne", 
"infectious" 
] 
}
Hints - Keys 
http://localhost:8098/types/diseases/buckets/infectious/keys?keys=true 
{ 
"keys": [ 
"Uhz73mNfxkEkcmFsLcgu3Kan5Dw", 
"D018319", 
"WapIL5eeRbnXkocmcK3YK5EDjFV", 
"9CkpJtAFziWuYSTfadW2rsf4bpF" 
] 
} 
or you can stream it 
http://localhost:8098/types/diseases/buckets/infectious/keys?keys=stream
Hints - Properties 
http://localhost:8098/types/diseases/buckets/infectious/props 
{ 
"props": { 
"name": "infectious", 
"w": "quorum", 
"rw": "quorum", 
"r": "quorum", 
"pw": 0, 
"precommit": [], 
"pr": 0, 
"postcommit": [], 
"notfound_ok": true, 
"n_val": 3, 
"last_write_wins": false, 
"dw": "quorum", 
"dvv_enabled": true, 
"chash_keyfun": { 
"basic_quorum": false, 
"allow_mult": true, 
"datatype": "set", 
"active": true, 
"claimant": “riak@127.0.0.1”, 
… 
} 
}
Backends 
• Bitcask, eLevelDB, Memory or Multi
The Cluster
The Cluster 
A cluster in Riak is a managed collection of nodes 
that share a common Ring.
The Ring 
Figure : Riak Ring, (Redmond & Daily, 2014, P. 11)
Replication + Partitions 
Figure : Replication Partitions, (Redmond & Daily, 2014, P. 10) 
But how?
vnodes 
Vnodes, are responsible 
for claiming a partition in 
the Riak Ring, and they 
coordinate requests for 
these partitions. 
n_val = 3 
Figure : Riak Ring, (Redmond & Daily, 2014, P. 11) 
ring_creation_size = 64 
favorite = 75017a36ec07fd4c377a0d2a011400ab193e61db
nodes & vnodes 
Figure : Riak Ring, (Redmond & Daily, 2014, P. 12)
The CAP
The CAP 
• Consistency (all nodes see the same data at the same 
time) 
• Availability (a guarantee that every request receives a 
response about whether it was successful or failed) 
• Partition tolerance (the system continues to operate 
despite arbitrary message loss or failure of part of the 
system) 
CAP loosely states that you can have a C (consistent), A 
(available), or P (partition-tolerant) system, but you can only 
choose 2, meaning CP or AP.
Replication & Write & Read 
• n_val=3 
• w=all (consistent, high latency) 
• r=all (consistent read, high latency) 
• w=3,r=1(likely consistent, low latency) 
per bucket basis 
Figure : NRW, (Redmond & Daily, 2014, P. 14)
The Quorum 
(floor(N/2) + 1) 
• nodes A,B,C,D,E,F,G,L,K,J (Don’t count it, it is 10) 
“n_val” : "5" 
“w" : "quorum" 
• w = floor(5/2)+1 
• w=3 
• PUT may respond successfully after writing to (A,B,C) and data will be 
eventually replicated to (D,E) 
why?
What about Delete?
What about Delete? 
• Object are marked as deleted with a 
marker(tombstone) and another process(reaper) will 
finish deleting the marked objects 
• A delete is actually a read and a write 
• Checking for the existence of a key(e.g. 
MapReduce,List) is not enough to know if an object 
exists. 
• Check for tombstone metadata(X-Riak-Deleted=true)
A Delete Operation 
• Client makes the request 
• Vnode : update vclock, store with tombstone 
• delete_mode = keep, 3000 ms, immediate 
• backend flags it as a tombstone (Bitcask or 
LevelDB) or wipes it immediately (in-memory) 
all r/w/n_val parameters must be met
Data Types
Data Types 
Allows RIAK to make sense of data(a data-aware system), 
so it can solve the conflicts. 
• Bucket Level: counters, sets, maps 
• In Maps : flags(enable, disable) and registers 
With and Without DataTypes 
[hostAddress]/types/<type>/buckets/<bucket>/keys/<key> 
[hostAddress]/types/<type>/buckets/<bucket>/datatypes/<key>
Data Type : Set 
Adding symptoms to the Influenza 
http://localhost:8098/types/diseases/buckets/infectious/datatypes/ 
D018319 
{"add_all":["Headaches", "Fatigue"]} 
{"add_all":["Cough", "Sore throat"]} 
{"remove": "Cough"} 
Result : {["Headaches","Fatigue","Sore throat"]}
Data Type : Map 
Adding more than symptoms to the Influenza 
http://localhost:8098/types/diseases/buckets/infectious/datatypes/D018319 
{ 
"update": { 
"symptoms_set": { 
"add_all": [ 
"Headaches", 
"Fatigue", 
"Sore throat" 
] 
} 
} 
} 
{ 
"update": { 
"name_register": "Influenza", 
"icd-9_register": "487" 
} 
}
Data Type : Map 
Adding and removing items from set 
{ 
"update": { 
"symptoms_set": { 
"remove": "Headaches", 
"add": "Fever" 
} 
} 
} 
Maps within maps 
{ 
"update": { 
"virus_classification_map": { 
"update": { 
"influenzavirus_A_register": "Some Text", 
"influenzavirus_B_register": "Some Text", 
"influenzavirus_C_register": "Some Text" 
} 
} 
} 
}
Data Type : Map 
And result is 
{ 
"type": "map", 
"value": { 
"virus_classification_map": { 
"influenzavirus_C_register": "Some Text", 
"influenzavirus_B_register": "Some Text", 
"influenzavirus_A_register": "Some Text" 
}, 
"symptoms_set": [ 
"Fatigue", 
"Fever", 
"Sore throat" 
], 
"name_register": "Influenza", 
"icd-9_register": "487" 
}, 
"context": "g2wAAAABaAJtAAAACCMJ/vlUQtGHYQRq" 
}
Last but not least 
• Search 
• Security 
• Hooks 
• A Little Riak Book : http://littleriakbook.com/
Questions!
Reference 
• Redmond, 
E., 
& 
Daily, 
J. 
(2014). 
A 
Little 
Riak 
Book. 
• Riak 
Docs. 
http://docs.basho.com/riak/latest/

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Apache Spark and DataStax Enablement
Apache Spark and DataStax EnablementApache Spark and DataStax Enablement
Apache Spark and DataStax Enablement
 
Analytics with Cassandra & Spark
Analytics with Cassandra & SparkAnalytics with Cassandra & Spark
Analytics with Cassandra & Spark
 
Apache Spark
Apache Spark Apache Spark
Apache Spark
 
Transformations and actions a visual guide training
Transformations and actions a visual guide trainingTransformations and actions a visual guide training
Transformations and actions a visual guide training
 
Big data analytics with Spark & Cassandra
Big data analytics with Spark & Cassandra Big data analytics with Spark & Cassandra
Big data analytics with Spark & Cassandra
 
Intro to apache spark stand ford
Intro to apache spark stand fordIntro to apache spark stand ford
Intro to apache spark stand ford
 
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
 
Zero to Streaming: Spark and Cassandra
Zero to Streaming: Spark and CassandraZero to Streaming: Spark and Cassandra
Zero to Streaming: Spark and Cassandra
 
Intro to Apache Spark
Intro to Apache SparkIntro to Apache Spark
Intro to Apache Spark
 
DataEngConf SF16 - Spark SQL Workshop
DataEngConf SF16 - Spark SQL WorkshopDataEngConf SF16 - Spark SQL Workshop
DataEngConf SF16 - Spark SQL Workshop
 
Hive dirty/beautiful hacks in TD
Hive dirty/beautiful hacks in TDHive dirty/beautiful hacks in TD
Hive dirty/beautiful hacks in TD
 
Spark ETL Techniques - Creating An Optimal Fantasy Baseball Roster
Spark ETL Techniques - Creating An Optimal Fantasy Baseball RosterSpark ETL Techniques - Creating An Optimal Fantasy Baseball Roster
Spark ETL Techniques - Creating An Optimal Fantasy Baseball Roster
 
Beyond Shuffling - Effective Tips and Tricks for Scaling Spark (Vancouver Sp...
Beyond Shuffling  - Effective Tips and Tricks for Scaling Spark (Vancouver Sp...Beyond Shuffling  - Effective Tips and Tricks for Scaling Spark (Vancouver Sp...
Beyond Shuffling - Effective Tips and Tricks for Scaling Spark (Vancouver Sp...
 
Introduction to spark
Introduction to sparkIntroduction to spark
Introduction to spark
 
Analytics with Cassandra, Spark & MLLib - Cassandra Essentials Day
Analytics with Cassandra, Spark & MLLib - Cassandra Essentials DayAnalytics with Cassandra, Spark & MLLib - Cassandra Essentials Day
Analytics with Cassandra, Spark & MLLib - Cassandra Essentials Day
 
Spark core
Spark coreSpark core
Spark core
 
Apache Spark - Intro to Large-scale recommendations with Apache Spark and Python
Apache Spark - Intro to Large-scale recommendations with Apache Spark and PythonApache Spark - Intro to Large-scale recommendations with Apache Spark and Python
Apache Spark - Intro to Large-scale recommendations with Apache Spark and Python
 
Introduction to Spark Internals
Introduction to Spark InternalsIntroduction to Spark Internals
Introduction to Spark Internals
 
Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori...
Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori...Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori...
Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori...
 
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
 

Ähnlich wie Riak 2.0 : For Beginners, and Everyone Else

Replication and Replica Sets
Replication and Replica SetsReplication and Replica Sets
Replication and Replica Sets
MongoDB
 
Async. and Realtime Geo Applications with Node.js
Async. and Realtime Geo Applications with Node.jsAsync. and Realtime Geo Applications with Node.js
Async. and Realtime Geo Applications with Node.js
Shoaib Burq
 
Ruby Language - A quick tour
Ruby Language - A quick tourRuby Language - A quick tour
Ruby Language - A quick tour
aztack
 
Nosql hands on handout 04
Nosql hands on handout 04Nosql hands on handout 04
Nosql hands on handout 04
Krishna Sankar
 

Ähnlich wie Riak 2.0 : For Beginners, and Everyone Else (20)

1.R_For_Libraries_Session_2_-_Data_Exploration.pptx
1.R_For_Libraries_Session_2_-_Data_Exploration.pptx1.R_For_Libraries_Session_2_-_Data_Exploration.pptx
1.R_For_Libraries_Session_2_-_Data_Exploration.pptx
 
R learning by examples
R learning by examplesR learning by examples
R learning by examples
 
Replication and Replica Sets
Replication and Replica SetsReplication and Replica Sets
Replication and Replica Sets
 
R for Pirates. ESCCONF October 27, 2011
R for Pirates. ESCCONF October 27, 2011R for Pirates. ESCCONF October 27, 2011
R for Pirates. ESCCONF October 27, 2011
 
R Basics
R BasicsR Basics
R Basics
 
Replication and Replica Sets
Replication and Replica SetsReplication and Replica Sets
Replication and Replica Sets
 
A Century Of Weather Data - Midwest.io
A Century Of Weather Data - Midwest.ioA Century Of Weather Data - Midwest.io
A Century Of Weather Data - Midwest.io
 
Ggplot2 v3
Ggplot2 v3Ggplot2 v3
Ggplot2 v3
 
Erlang for data ops
Erlang for data opsErlang for data ops
Erlang for data ops
 
Async. and Realtime Geo Applications with Node.js
Async. and Realtime Geo Applications with Node.jsAsync. and Realtime Geo Applications with Node.js
Async. and Realtime Geo Applications with Node.js
 
Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup Edinburgh
 
groovy & grails - lecture 2
groovy & grails - lecture 2groovy & grails - lecture 2
groovy & grails - lecture 2
 
Rob Sullivan at Heroku's Waza 2013: Your Database -- A Story of Indifference
Rob Sullivan at Heroku's Waza 2013: Your Database -- A Story of IndifferenceRob Sullivan at Heroku's Waza 2013: Your Database -- A Story of Indifference
Rob Sullivan at Heroku's Waza 2013: Your Database -- A Story of Indifference
 
Closing the Loop in Extended Reality with Kafka Streams and Machine Learning ...
Closing the Loop in Extended Reality with Kafka Streams and Machine Learning ...Closing the Loop in Extended Reality with Kafka Streams and Machine Learning ...
Closing the Loop in Extended Reality with Kafka Streams and Machine Learning ...
 
R-programming-training-in-mumbai
R-programming-training-in-mumbaiR-programming-training-in-mumbai
R-programming-training-in-mumbai
 
Ruby Language - A quick tour
Ruby Language - A quick tourRuby Language - A quick tour
Ruby Language - A quick tour
 
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your DataMongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
 
P2 2017 python_strings
P2 2017 python_stringsP2 2017 python_strings
P2 2017 python_strings
 
Nosql hands on handout 04
Nosql hands on handout 04Nosql hands on handout 04
Nosql hands on handout 04
 
DataMapper
DataMapperDataMapper
DataMapper
 

Kürzlich hochgeladen

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Kürzlich hochgeladen (20)

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 

Riak 2.0 : For Beginners, and Everyone Else

  • 1. RIAK 2.0 Engin Yöyen October, 2014
  • 2. What is Riak • Key/Value Store • hashTable[‘D018319’] = ‘Influenza’ • diseases = hashTable[‘D018319’]
  • 3. Buckets • There is no global namespace. • All keys must belong to a bucket. • diseases[‘D018319’] = ‘Influenza’ • symptoms[‘D018319’] = ‘cervical pains’
  • 4. Why Bucket Types • diseases[‘infectious’][‘D018319’] = ‘Influenza’ • diseases[‘blood-borne’][‘F023831’] = ‘Hepatitis B’ • Groups of buckets with a similar set of properties. • diseases.props = {"search_index":"anyplace"}
  • 6. The API via HTTP methods PUT, GET, POST, DELETE Example [hostAddress]/types/<type>/buckets/<bucket>/keys/<key>
  • 7. PUT curl -XPUT "http://localhost:8098/types/diseases/buckets/ infectious/keys/D018319" -H "Content-Type:text/plain" -d "Influenza, commonly known as, the flu, ...." riak-admin bucket-type create diseases '{"props": {"datatype":"set"}}' riak-admin bucket-type activate diseases
  • 8. PUT (2) curl -v -XPUT "http://localhost:8098/types/diseases/buckets/ infectious/keys/D018319" -H "Content-Type: application/json" -d '{"desc": "Influenza, commonly known as, the flu, …."}' Hint : http://localhost:8098/types/diseases/buckets/infectious/keys/D018319?returnbody=true
  • 11. Delete I am sure you all figured out by now….
  • 12. Hints
  • 13. Hints - Buckets http://localhost:8098/types/diseases/buckets?buckets=true { "buckets": [ "blood-borne", "infectious" ] }
  • 14. Hints - Keys http://localhost:8098/types/diseases/buckets/infectious/keys?keys=true { "keys": [ "Uhz73mNfxkEkcmFsLcgu3Kan5Dw", "D018319", "WapIL5eeRbnXkocmcK3YK5EDjFV", "9CkpJtAFziWuYSTfadW2rsf4bpF" ] } or you can stream it http://localhost:8098/types/diseases/buckets/infectious/keys?keys=stream
  • 15. Hints - Properties http://localhost:8098/types/diseases/buckets/infectious/props { "props": { "name": "infectious", "w": "quorum", "rw": "quorum", "r": "quorum", "pw": 0, "precommit": [], "pr": 0, "postcommit": [], "notfound_ok": true, "n_val": 3, "last_write_wins": false, "dw": "quorum", "dvv_enabled": true, "chash_keyfun": { "basic_quorum": false, "allow_mult": true, "datatype": "set", "active": true, "claimant": “riak@127.0.0.1”, … } }
  • 16. Backends • Bitcask, eLevelDB, Memory or Multi
  • 18. The Cluster A cluster in Riak is a managed collection of nodes that share a common Ring.
  • 19. The Ring Figure : Riak Ring, (Redmond & Daily, 2014, P. 11)
  • 20. Replication + Partitions Figure : Replication Partitions, (Redmond & Daily, 2014, P. 10) But how?
  • 21. vnodes Vnodes, are responsible for claiming a partition in the Riak Ring, and they coordinate requests for these partitions. n_val = 3 Figure : Riak Ring, (Redmond & Daily, 2014, P. 11) ring_creation_size = 64 favorite = 75017a36ec07fd4c377a0d2a011400ab193e61db
  • 22. nodes & vnodes Figure : Riak Ring, (Redmond & Daily, 2014, P. 12)
  • 24. The CAP • Consistency (all nodes see the same data at the same time) • Availability (a guarantee that every request receives a response about whether it was successful or failed) • Partition tolerance (the system continues to operate despite arbitrary message loss or failure of part of the system) CAP loosely states that you can have a C (consistent), A (available), or P (partition-tolerant) system, but you can only choose 2, meaning CP or AP.
  • 25. Replication & Write & Read • n_val=3 • w=all (consistent, high latency) • r=all (consistent read, high latency) • w=3,r=1(likely consistent, low latency) per bucket basis Figure : NRW, (Redmond & Daily, 2014, P. 14)
  • 26. The Quorum (floor(N/2) + 1) • nodes A,B,C,D,E,F,G,L,K,J (Don’t count it, it is 10) “n_val” : "5" “w" : "quorum" • w = floor(5/2)+1 • w=3 • PUT may respond successfully after writing to (A,B,C) and data will be eventually replicated to (D,E) why?
  • 28. What about Delete? • Object are marked as deleted with a marker(tombstone) and another process(reaper) will finish deleting the marked objects • A delete is actually a read and a write • Checking for the existence of a key(e.g. MapReduce,List) is not enough to know if an object exists. • Check for tombstone metadata(X-Riak-Deleted=true)
  • 29. A Delete Operation • Client makes the request • Vnode : update vclock, store with tombstone • delete_mode = keep, 3000 ms, immediate • backend flags it as a tombstone (Bitcask or LevelDB) or wipes it immediately (in-memory) all r/w/n_val parameters must be met
  • 31. Data Types Allows RIAK to make sense of data(a data-aware system), so it can solve the conflicts. • Bucket Level: counters, sets, maps • In Maps : flags(enable, disable) and registers With and Without DataTypes [hostAddress]/types/<type>/buckets/<bucket>/keys/<key> [hostAddress]/types/<type>/buckets/<bucket>/datatypes/<key>
  • 32. Data Type : Set Adding symptoms to the Influenza http://localhost:8098/types/diseases/buckets/infectious/datatypes/ D018319 {"add_all":["Headaches", "Fatigue"]} {"add_all":["Cough", "Sore throat"]} {"remove": "Cough"} Result : {["Headaches","Fatigue","Sore throat"]}
  • 33. Data Type : Map Adding more than symptoms to the Influenza http://localhost:8098/types/diseases/buckets/infectious/datatypes/D018319 { "update": { "symptoms_set": { "add_all": [ "Headaches", "Fatigue", "Sore throat" ] } } } { "update": { "name_register": "Influenza", "icd-9_register": "487" } }
  • 34. Data Type : Map Adding and removing items from set { "update": { "symptoms_set": { "remove": "Headaches", "add": "Fever" } } } Maps within maps { "update": { "virus_classification_map": { "update": { "influenzavirus_A_register": "Some Text", "influenzavirus_B_register": "Some Text", "influenzavirus_C_register": "Some Text" } } } }
  • 35. Data Type : Map And result is { "type": "map", "value": { "virus_classification_map": { "influenzavirus_C_register": "Some Text", "influenzavirus_B_register": "Some Text", "influenzavirus_A_register": "Some Text" }, "symptoms_set": [ "Fatigue", "Fever", "Sore throat" ], "name_register": "Influenza", "icd-9_register": "487" }, "context": "g2wAAAABaAJtAAAACCMJ/vlUQtGHYQRq" }
  • 36. Last but not least • Search • Security • Hooks • A Little Riak Book : http://littleriakbook.com/
  • 38. Reference • Redmond, E., & Daily, J. (2014). A Little Riak Book. • Riak Docs. http://docs.basho.com/riak/latest/