O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
An introduction to #CouchDB
        Sit back and relax




    @davidcoallier, University Limerick 2010
WTF IS COUCH?
- Highly concurrent database server
- Schema free, document based database
- RESTFul API
- Map/Reduce Views ...
... AGAIN.. WTF?!
HISTORY CLASS TIME!
32 CouchDB servers
                                            2 datacenters
                                   SSL based ...
Ubuntu One
mozilla.org
       IBM
      Apple
  myspace.com
      ebay
     meebo
oh so many more.
DOCUMENT BASED
KEY/VALUE STORE...
key       value
  name       david
  email    e@e.com
 phones      Array
createdAt timetsamp
DOCUMENT BASED WHAT?
- Dictionary of data
- JSON Objects
- A doc can have attachments
- Auto generated IDs (CLAP NOW)
- Re...
DOCUMENT

{
    "_id": "3fc3b3bf3c101e15fa7d08e2ecf9c900",
    "_rev": "1-34c5c7adcf1fdb8898498d1e6b64ebdd",
    "firstnam...
DOCUMENT
{
    "_id": "3fc3b3bf3c101e15fa7d08e2ecf9c900",
    "_rev": "1-34c5c7adcf1fdb8898498d1e6b64ebdd",
    "firstname...
key       value
  name       david
  email    e@e.com
 phones      Array
createdAt timetsamp
WHAT ABOUT MY CRUD?

   - Create     PUT /db/docid
   - Retrieve   GET /db/docid
   - Update     POST /db/docid
   - Delet...
VIEWS

- Persistent representation of docs
- Prod is solid. No _temp shit.
- Javascript, Erlang, Python, wtf ever.
MAP/REDUCE ...
JAVASCRIPT
MAP

map: function(doc) {
    if (doc.firstname) {
        emit(doc.firstname, doc);
    }
}
MAP
%% Map Function
fun({Doc}) ->
     case {proplists:get_value(<<"firstname">>, Doc)} of
    {undefined} ->
          fa...
fun({Doc}) ->
    Emitter = fun(Doc) ->
        Name = proplists:get_value(<<"name">>, Doc, null),

              Emit(Nam...
MAP/REDUCE EXAMPLE
MAP
{
    "_id": "3fc3b3bf3c101e15fa7d08e2ecf9c900",
    "_rev": "1-34c5c7adcf1fdb8898498d1e6b64ebdd",
    "firstname": "D...
MAP

map: function(doc) {
    if (doc.tags && docs.tags.length > 0) {
        for (var i = 0; i < doc.tags.length; i++) {
...
REDUCE
map: function(doc) {
    if (doc.tags && docs.tags.length > 0) {
        for (var i = 0; i < doc.tags.length; i++) ...
REDUCE

function(tag, counts) {
    int sum = 0;
    for(var i = 0; i < counts.length; i++) {
        sum += counts[i];
  ...
REDUCE
{
    "total_rows":4,
    "rows":[
        { "key":"cool",
          "value":1},

        { "key":"php",
          ...
REDUCE TRICKS
map: function(doc) {
    if (doc.tags && docs.tags.length > 0) {
        for (var i = 0; i < doc.tags.length...
REDUCE
{
    "total_rows":4,
    "rows":[
        { "key":"cool",
          "value":1},

        { "key":"php",
          ...
REDUCE
map: function(doc) {
    if (doc.tags && docs.tags.length > 0) {
        for (var i = 0; i < doc.tags.length; i++) ...
THEN...
BEWARE OF REDUCE VALUES
REPLICATION


  It fuckin’ rules.
REPLICATION

      Easy (See later futon ;-))
        Continuous... or not :P
        Replicates your views
Replicate only...
REPLICATION
                   curl -X POST http://localhost:5984/_replicate 
'{"source":"/dbname", "target": "http://loca...
REPLICATION
Source              The boss               Target

         changes?              watcha
                     ...
REPLICATION
MASTER / SLAVES
REPLICATION
MASTER / SLAVES
REPLICATION
MULTI MASTER
REPLICATION
MULTI MASTER
REPLICATION
  USE CASE



    Automated job
to validate and test data
 and do bunch of shits
FUTON
FUTON
NOTE TO SELF.


   Show them.




                Open up CouchDBX
COOL THINGS
         Authorization
        CouchDB Lucene
            Lounge
          CouchDBX
           Couchio
       ...
COMPLETE SHITE COMING UP


                                                      eas
                                     ...
CONCEPTS AND IDEAS


      Graph Theory




                                                        ...
                  ...
CONCEPTS AND IDEAS


     Ghost Replication




                                                            ...
          ...
CONCEPTS AND IDEAS


   Shared Index Replication




                                                                 ...
...
QUESTIONS?
ME! MEEE!!!


   @davidcoallier
david@echolibre.com
THANKS
LINKS

- https://nosqleast.com/2009/slides/miller-couchdb.pdf
- http://couch.io
- http://cloudant.com
- http://wiki.apache...
An introduction to CouchDB
Próximos SlideShares
Carregando em…5
×

de

An introduction to CouchDB Slide 1 An introduction to CouchDB Slide 2 An introduction to CouchDB Slide 3 An introduction to CouchDB Slide 4 An introduction to CouchDB Slide 5 An introduction to CouchDB Slide 6 An introduction to CouchDB Slide 7 An introduction to CouchDB Slide 8 An introduction to CouchDB Slide 9 An introduction to CouchDB Slide 10 An introduction to CouchDB Slide 11 An introduction to CouchDB Slide 12 An introduction to CouchDB Slide 13 An introduction to CouchDB Slide 14 An introduction to CouchDB Slide 15 An introduction to CouchDB Slide 16 An introduction to CouchDB Slide 17 An introduction to CouchDB Slide 18 An introduction to CouchDB Slide 19 An introduction to CouchDB Slide 20 An introduction to CouchDB Slide 21 An introduction to CouchDB Slide 22 An introduction to CouchDB Slide 23 An introduction to CouchDB Slide 24 An introduction to CouchDB Slide 25 An introduction to CouchDB Slide 26 An introduction to CouchDB Slide 27 An introduction to CouchDB Slide 28 An introduction to CouchDB Slide 29 An introduction to CouchDB Slide 30 An introduction to CouchDB Slide 31 An introduction to CouchDB Slide 32 An introduction to CouchDB Slide 33 An introduction to CouchDB Slide 34 An introduction to CouchDB Slide 35 An introduction to CouchDB Slide 36 An introduction to CouchDB Slide 37 An introduction to CouchDB Slide 38 An introduction to CouchDB Slide 39 An introduction to CouchDB Slide 40 An introduction to CouchDB Slide 41 An introduction to CouchDB Slide 42 An introduction to CouchDB Slide 43 An introduction to CouchDB Slide 44 An introduction to CouchDB Slide 45 An introduction to CouchDB Slide 46 An introduction to CouchDB Slide 47 An introduction to CouchDB Slide 48 An introduction to CouchDB Slide 49 An introduction to CouchDB Slide 50 An introduction to CouchDB Slide 51 An introduction to CouchDB Slide 52 An introduction to CouchDB Slide 53
Próximos SlideShares
CouchDB Vs MongoDB
Avançar
Transfira para ler offline e ver em ecrã inteiro.

29 gostaram

Compartilhar

Baixar para ler offline

An introduction to CouchDB

Baixar para ler offline

This is a talk I presented at University Limerick to give people an introduction into CouchDB.

What is it? How does it generally work? Introducing new concepts, etc.

Audiolivros relacionados

Gratuito durante 30 dias do Scribd

Ver tudo

An introduction to CouchDB

  1. 1. An introduction to #CouchDB Sit back and relax @davidcoallier, University Limerick 2010
  2. 2. WTF IS COUCH? - Highly concurrent database server - Schema free, document based database - RESTFul API - Map/Reduce Views generation - EASY replication (like... really)
  3. 3. ... AGAIN.. WTF?!
  4. 4. HISTORY CLASS TIME!
  5. 5. 32 CouchDB servers 2 datacenters SSL based user auth, sharding, etc. This is the only BBC transparent logo I found and it’s not BBC World News using CouchDB but BBC. See: http://www.erlang-factory.com/conference/London2009/speakers/endafarrell
  6. 6. Ubuntu One
  7. 7. mozilla.org IBM Apple myspace.com ebay meebo oh so many more.
  8. 8. DOCUMENT BASED KEY/VALUE STORE...
  9. 9. key value name david email e@e.com phones Array createdAt timetsamp
  10. 10. DOCUMENT BASED WHAT? - Dictionary of data - JSON Objects - A doc can have attachments - Auto generated IDs (CLAP NOW) - Revisions (THAT’S RIGHT..)
  11. 11. DOCUMENT { "_id": "3fc3b3bf3c101e15fa7d08e2ecf9c900", "_rev": "1-34c5c7adcf1fdb8898498d1e6b64ebdd", "firstname": "David", "email": "david@echolibre.com" }
  12. 12. DOCUMENT { "_id": "3fc3b3bf3c101e15fa7d08e2ecf9c900", "_rev": "1-34c5c7adcf1fdb8898498d1e6b64ebdd", "firstname": "David", "email": "david@echolibre.com", "phones": { "mobile": "086x209x69", "home": "none" }, "createdAt": "2009-09-16T22:12:43Z" }
  13. 13. key value name david email e@e.com phones Array createdAt timetsamp
  14. 14. WHAT ABOUT MY CRUD? - Create PUT /db/docid - Retrieve GET /db/docid - Update POST /db/docid - Delete DELETE /db/docid
  15. 15. VIEWS - Persistent representation of docs - Prod is solid. No _temp shit. - Javascript, Erlang, Python, wtf ever.
  16. 16. MAP/REDUCE ...
  17. 17. JAVASCRIPT
  18. 18. MAP map: function(doc) { if (doc.firstname) { emit(doc.firstname, doc); } }
  19. 19. MAP %% Map Function fun({Doc}) -> case {proplists:get_value(<<"firstname">>, Doc)} of {undefined} -> false; {Name} -> Emit(Name, Doc); _ -> ok end end.
  20. 20. fun({Doc}) -> Emitter = fun(Doc) -> Name = proplists:get_value(<<"name">>, Doc, null), Emit(Name, Doc) end, HasRequiredFields = fun(Doc) -> case {proplists:is_defined(<<"firstname">>, Doc)} of {true} -> Emitter(Doc); _-> false end end, HasRequiredFields(Doc) end.
  21. 21. MAP/REDUCE EXAMPLE
  22. 22. MAP { "_id": "3fc3b3bf3c101e15fa7d08e2ecf9c900", "_rev": "1-34c5c7adcf1fdb8898498d1e6b64ebdd", "firstname": "David", "email": "david@echolibre.com", "phones": { "mobile": "086x209x69", "home": "none" }, "createdAt": "2009-09-16T22:12:43Z", "tags": ["cool", "php", "couchdb", "skynet"] }
  23. 23. MAP map: function(doc) { if (doc.tags && docs.tags.length > 0) { for (var i = 0; i < doc.tags.length; i++) { emit(doc.tags[i], 1); } } }
  24. 24. REDUCE map: function(doc) { if (doc.tags && docs.tags.length > 0) { for (var i = 0; i < doc.tags.length; i++) { emit(doc.tags[i], 1); } } }, reduce: function(tag, counts) { int sum = 0; for(var i = 0; i < counts.length; i++) { sum += counts[i]; } return sum; }
  25. 25. REDUCE function(tag, counts) { int sum = 0; for(var i = 0; i < counts.length; i++) { sum += counts[i]; } return sum; }
  26. 26. REDUCE { "total_rows":4, "rows":[ { "key":"cool", "value":1}, { "key":"php", "value":1}, { "key":"couchdb", "value":1}, { "key":"skynet", "value":1}, ] }
  27. 27. REDUCE TRICKS map: function(doc) { if (doc.tags && docs.tags.length > 0) { for (var i = 0; i < doc.tags.length; i++) { emit(doc.tags[i], 1); } } } reduce: "_count"
  28. 28. REDUCE { "total_rows":4, "rows":[ { "key":"cool", "value":1}, { "key":"php", "value":1}, { "key":"couchdb", "value":1}, { "key":"skynet", "value":1}, ] }
  29. 29. REDUCE map: function(doc) { if (doc.tags && docs.tags.length > 0) { for (var i = 0; i < doc.tags.length; i++) { emit(doc.tags[i], "yer ma"); } } }, reduce: function (tag, count) { return sum(tag); }
  30. 30. THEN...
  31. 31. BEWARE OF REDUCE VALUES
  32. 32. REPLICATION It fuckin’ rules.
  33. 33. REPLICATION Easy (See later futon ;-)) Continuous... or not :P Replicates your views Replicate only what you need (filter?)
  34. 34. REPLICATION curl -X POST http://localhost:5984/_replicate '{"source":"/dbname", "target": "http://localhost:5555/otherdb", "continuous": true}'
  35. 35. REPLICATION Source The boss Target changes? watcha need?? target needs x, y, z save them
  36. 36. REPLICATION MASTER / SLAVES
  37. 37. REPLICATION MASTER / SLAVES
  38. 38. REPLICATION MULTI MASTER
  39. 39. REPLICATION MULTI MASTER
  40. 40. REPLICATION USE CASE Automated job to validate and test data and do bunch of shits
  41. 41. FUTON
  42. 42. FUTON
  43. 43. NOTE TO SELF. Show them. Open up CouchDBX
  44. 44. COOL THINGS Authorization CouchDB Lucene Lounge CouchDBX Couchio Cloudant A bunch of random bits and pieces
  45. 45. COMPLETE SHITE COMING UP eas r e id sha W le! NO p s peo cus Dis
  46. 46. CONCEPTS AND IDEAS Graph Theory ... ss ion u a disc t d star tr y an
  47. 47. CONCEPTS AND IDEAS Ghost Replication ... ss ion u a disc t d star tr y an
  48. 48. CONCEPTS AND IDEAS Shared Index Replication ... ss ion u a disc t d star tr y an
  49. 49. QUESTIONS?
  50. 50. ME! MEEE!!! @davidcoallier david@echolibre.com
  51. 51. THANKS
  52. 52. LINKS - https://nosqleast.com/2009/slides/miller-couchdb.pdf - http://couch.io - http://cloudant.com - http://wiki.apache.org/couchdb/CouchDB_in_the_wild - irc://couchdb@freenode.net (Bug jan___ ;-))
  • tamilarya

    Nov. 9, 2016
  • jj_tyro

    Jul. 31, 2015
  • AmyVal

    Jun. 10, 2015
  • fcollova

    May. 2, 2014
  • MinhDo7

    Apr. 19, 2014
  • praptiparalkar

    Jul. 16, 2013
  • cute_walker

    Jan. 9, 2013
  • fengfranklu

    Jan. 2, 2013
  • psakthisivram

    Nov. 8, 2012
  • edmundsmedvedevs

    Sep. 22, 2012
  • dkrizic

    Mar. 6, 2012
  • dariobarila

    Nov. 18, 2011
  • pedroherub

    Nov. 11, 2011
  • pangqiren

    Aug. 6, 2011
  • declan.cox

    Feb. 13, 2011
  • mfazal

    Jan. 12, 2011
  • aboynejames

    Dec. 15, 2010
  • cloudqq

    Nov. 9, 2010
  • metoikos

    Jul. 30, 2010
  • jgirmay

    Jul. 19, 2010

This is a talk I presented at University Limerick to give people an introduction into CouchDB. What is it? How does it generally work? Introducing new concepts, etc.

Vistos

Vistos totais

12.113

No Slideshare

0

De incorporações

0

Número de incorporações

4.006

Ações

Baixados

477

Compartilhados

0

Comentários

0

Curtir

29

×