Your SlideShare is downloading. ×
Utah PHP Users Group - 2012
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Utah PHP Users Group - 2012

1,677
views

Published on

Introduction slide deck to Riak using the PHP client.

Introduction slide deck to Riak using the PHP client.

Published in: Technology

2 Comments
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total Views
1,677
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
2
Comments
2
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Used for moving data around & dealing with failures - without applications noticing.\n\ndue to how data is replicated, there is no SPOF, or master / slave setup.\n\ndue to no SPOF and how replication is done, every node in the cluster looks the same.\n - can read and write from each node\n - turns out to be operationally friendly.\n\n\nAT&T for mHealth is using Riak replication across multiple data centers.\n\n
  • always accepts writes.\n - (will not talk in detail, but you can ask me questions, send me email, or bug me on twitter).\n - causes the need to read repair.\n - eventually consistent. (tough for some people to grok at first).\n - ask me questions, or find me after & we can chat all day long about it.\n
  • \n
  • X = throughput, compute power for MapReduce, storage, lower latency\nData center replication. Focus on disaster survival vs recovery.\nenables us to have local data access no matter where you are.\n\n
  • Basic operations are done over HTTP or a Protocol Buffer interface.\n\ndon’t spend much time here\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • will not talk about in detail, but you can ask questions\n - again, twitter\n\ndon’t spend much time here\n
  • will not talk about in detail, but you can ask questions\n - again, twitter\n\ndon’t spend much time here\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • will not talk about in detail, but you can ask questions\n - again, twitter\n\ndon’t spend much time here\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. Intro to Riak
    • 2. Randy Secrist @randysecristrsecrist@basho.com
    • 3. _Intro to Riak
    • 4. Riak is a Database
    • 5. Riak is Open Source http://git.io/basho http://git.io/riak http://git.io/riak_core http://git.io/riak_kv
    • 6. Riak is Eventually
    • 7. Eventual ...Consistency
    • 8. CAP• Consistency• Availability• Partitioning
    • 9. BASE• Basically• Available• Soft• State
    • 10. Riak’s Strong Areas• Availability• Partitioning
    • 11. Riak is also ...
    • 12. • Fault-Tolerant• Highly-Available• Geo Distributable, horizontally scaleable• Built for the Web
    • 13. Fault-Tolerant• All nodes participate equally - no SPOF• All data is replicated• Cluster transparently survives ... • node failures • network partitions• Built on Erlang/OTP (designed for FT)
    • 14. Highly-Available• Masterless: Any node can service client requests.• Fallbacks are used when nodes are down.• Always accepts read and write requests.• Per-Request Quorums
    • 15. SCALES
    • 16. Geo Distributable & Horizontally Scalable• Default configuration is in a cluster• Load and data are spread evenly• Add more nodes to get more X• Multi Data Center Replication*
    • 17. Built for the Web• HTTP is default (but not only) interface• Does HTTP/REST well (see Webmachine)• Plays well with HTTP infrastructure - reverse proxy caches, load balancers, web servers.• Suitable for many web and mobile applications.
    • 18. Riak Features
    • 19. Native APIs
    • 20. HTTP
    • 21. Protocol Buffers
    • 22. Client Libraries
    • 23. Erlang
    • 24. Ruby
    • 25. Java
    • 26. Python
    • 27. PHPhttps://github.com/basho/riak-php-client
    • 28. Many more client librarieshttp://wiki.basho.com/Client-Libraries.html
    • 29. Querying• Key Value - get, put, delete • Value is mostly opaque (some metadata)• Secondary Indexes• Map Reduce• Links• Full Text Search (Lucene Style)
    • 30. Storage Backends• Bitcask• LevelDB• Memory• Multi
    • 31. Request Quorums• Every request contacts all replicas of key• N - number of replicas (default 3)• R - read quorum• W - write quorum
    • 32. Hands on!Setting it Up!
    • 33. brew install riak
    • 34. /usr/local/bin/riak start
    • 35. Use ‘join’ command to build a cluster
    • 36. Main Config File etc/app.config
    • 37. Rekonhttps://github.com/basho/rekon curl -s rekon.basho.com | sh or curl -s rekon.basho.com | node=node-addr:port sh
    • 38. PHP Client Demo
    • 39. Connecting to Riakrequire_once(riak-php-client/riak.php);$client = new RiakClient(127.0.0.1, 8098);
    • 40. Buckets$bucket = $client->bucket(friends);
    • 41. Writing Data$person = $bucket->newObject(‘jack’,array( ‘name’ => “Jack Bauer”, ‘age’ => 24, ‘hobbies’ => “Interrogation”));$person->store();
    • 42. Getting Data$jack = $bucket->get(jack);$me = $bucket->get(randy);
    • 43. Riak Objectsforeach ($me->data as $key =>$value) print($key);
    • 44. PHP DocumentationReadme: http://git.io/pk5umAPHP Docs: http://git.io/9YYaKQ
    • 45. s3:// compatible layer http://basho.com/products/riakcs
    • 46. Thank You!
    • 47. References• http://www.infoq.com/articles/cap-twelve-years-later-how-the-rules-have-changed• http://www.odbms.org/blog/2012/08/on-eventual-consistency-an-interview-with-justin-sheehy/• http://pbs.cs.berkeley.edu/#demo• https://github.com/basho/riak-php-client/blob/master/README.md
    • 48. Credits• Slides by Casey Rosenthal• Slides by Bryce Kerley
    • 49. Consistent Hashing & The Ring
    • 50. Consistent Hashing & The Ring• 160-bit integer keyspace 0 2 160/4 2 160/2
    • 51. Consistent Hashing & The Ring• 160-bit integer keyspace• Divided into fixed 0 number of evenly-sized partitions 32 partitions 2 160/4 2 160/2
    • 52. Consistent Hashing & The Ring node 0 node 1• 160-bit integer keyspace node 2• Divided into fixed 0 node 3 number of evenly-sized partitions• Partitions are claimed by 32 partitions 2 160/4 nodes in the cluster 2 160/2
    • 53. Consistent Hashing & The Ring node 0 node 1• 160-bit integer keyspace node 2• Divided into fixed node 3 number of evenly-sized partitions• Partitions are claimed by nodes in the cluster• Replicas go to the N partitions following the key
    • 54. Consistent Hashing & The Ring node 0 node 1• 160-bit integer keyspace node 2• Divided into fixed node 3 number of evenly-sized partitions• Partitions are claimed by nodes in the cluster N=3• Replicas go to the N partitions following the key hash(“utah/uphpu”)
    • 55. Hinted Handoff
    • 56. Hinted Handoff• Node fails X X X X X X X X
    • 57. Hinted Handoff• Node fails X X• Requests go to fallback X X X X X X hash(“utah/uphpu”)
    • 58. Hinted Handoff• Node fails• Requests go to fallback• Node comes back hash(“utah/uphpu”)
    • 59. Hinted Handoff• Node fails• Requests go to fallback• Node comes back• “Handoff” - data returns to recovered node hash(“utah/uphpu”)
    • 60. Hinted Handoff• Node fails• Requests go to fallback• Node comes back• “Handoff” - data returns to recovered node• Normal operations resume hash(“utah/uphpu”)
    • 61. Riak ArchitectureErlang/OTP Runtime
    • 62. Riak ArchitectureErlang/OTP Runtime Riak KV
    • 63. Riak ArchitectureErlang/OTP Runtime Client APIs Riak KV
    • 64. Riak ArchitectureErlang/OTP Runtime Client APIs HTTP Riak KV
    • 65. Riak ArchitectureErlang/OTP Runtime Client APIs HTTP Protocol Buffers Riak KV
    • 66. Riak ArchitectureErlang/OTP Runtime Client APIs HTTP Protocol Buffers Erlang local client Riak KV
    • 67. Riak ArchitectureErlang/OTP Runtime Client APIs HTTP Protocol Buffers Erlang local client Request Coordination Riak KV
    • 68. Riak ArchitectureErlang/OTP Runtime Client APIs HTTP Protocol Buffers Erlang local client Request Coordination get put delete map-reduce Riak KV
    • 69. Riak ArchitectureErlang/OTP Runtime Client APIs HTTP Protocol Buffers Erlang local client Request Coordination get put delete map-reduce Riak Core Riak KV
    • 70. Riak ArchitectureErlang/OTP Runtime Client APIs HTTP Protocol Buffers Erlang local client Request Coordination get put delete map-reduce consistent hashing Riak Core Riak KV
    • 71. Riak ArchitectureErlang/OTP Runtime Client APIs HTTP Protocol Buffers Erlang local client Request Coordination get put delete map-reduce consistent hashing membership Riak Core Riak KV
    • 72. Riak ArchitectureErlang/OTP Runtime Client APIs HTTP Protocol Buffers Erlang local client Request Coordination get put delete map-reduce consistent hashing handoff membership Riak Core Riak KV
    • 73. Riak ArchitectureErlang/OTP Runtime Client APIs HTTP Protocol Buffers Erlang local client Request Coordination get put delete map-reduce consistent hashing handoff membership node-liveness Riak Core Riak KV
    • 74. Riak ArchitectureErlang/OTP Runtime Client APIs HTTP Protocol Buffers Erlang local client Request Coordination get put delete map-reduce consistent hashing handoff gossip membership node-liveness Riak Core Riak KV
    • 75. Riak ArchitectureErlang/OTP Runtime Client APIs HTTP Protocol Buffers Erlang local client Request Coordination get put delete map-reduce consistent hashing handoff gossip membership node-liveness buckets Riak Core Riak KV
    • 76. Riak ArchitectureErlang/OTP Runtime Client APIs HTTP Protocol Buffers Erlang local client Request Coordination get put delete map-reduce consistent hashing handoff gossip membership node-liveness buckets Riak Core vnode master Riak KV
    • 77. Riak ArchitectureErlang/OTP Runtime Client APIs HTTP Protocol Buffers Erlang local client Request Coordination get put delete map-reduce consistent hashing handoff gossip membership node-liveness buckets Riak Core vnode master vnodes Riak KV
    • 78. Riak ArchitectureErlang/OTP Runtime Client APIs HTTP Protocol Buffers Erlang local client Request Coordination get put delete map-reduce consistent hashing handoff gossip membership node-liveness buckets Riak Core vnode master vnodes storage backend Riak KV
    • 79. Riak ArchitectureErlang/OTP Runtime Client APIs HTTP Protocol Buffers Erlang local client Request Coordination get put delete map-reduce consistent hashing handoff gossip membership node-liveness buckets Riak Core vnode master vnodes JS Runtime storage backend Riak KV