SlideShare ist ein Scribd-Unternehmen logo
1 von 36
Downloaden Sie, um offline zu lesen
CouchDB relax



                   Kota Sakoda



2009   6   1
•   cohtan ( Kota Sakoda )

               •
               •
               •
               •
               •   codecheck.in


2009   6   1
Agenda

               •   DB     CouchDB



               •


2009   6   1
What’s CouchDB?
               • Erlang                    DB

               •                      Not Relational!

               •           RESTful API

               •         SQL           MapReduce

               • N-Master Replication
2009   6   1
Erlang



2009   6   1
Erlang

               •
               •
               • 0.9.0                            11067   !
                 ($ cat src/couchdb/*.erl | wc)



2009   6   1
Document Oriented



2009   6   1
Document Oriented
               • RDB
               •1       JSON

               • JSON

               •
2009   6   1
{
                 “_id”: “ABCDEFG”,
                 “_rev”: “1-AB123C”,
                 “type”: “person”,
                 “name”: “Kota Sakoda”,
                 “age”: 29,
                 “computer”:
                   [”MacBook Air”, “MacBook”, “Inspiron
               Mini 12”],
               }


2009   6   1
{
                 “_id”: “ABCDEFG”,
                 “_rev”: “2-AB123C”,
                 “type”: “person”,
                 “name”: “Kota Sakoda”,
                 “age”: 29,
                 “computer”:
                   [”MacBook Air”, “MacBook”, “Inspiron
               Mini 12”, “SC430”],
                 “hobby”:{“program”:[”perl”,”erlang”]}
               }

2009   6   1
RESTful API



2009   6   1
RESTful API
               • Crete
                 HTTP PUT /dbname/docid
               • Read
                 HTTP GET /dbname/docid
               • Update
                 HTTP PUT /dbname/docid
               • Delete
                 HTTP DELETE /dbname/docid

2009   6   1
RESTful API

               •
                   http://wiki.apache.org/couchdb/Basics
               • Amazon EC2, ExtJS, C, C#, Erlang, Futon,
                   Haskell, Java, JavaScript, LISP, LotusScript,
                   Objective-C, Perl, PHP, Python, Ruby,
                   Smalltalk



2009   6   1
MapReduce Framework



2009   6   1
MapReduce Framework
               • JavaScript MapReduce!
               • Map JSON
                            KeyValue

               • Reduce   KeyValue




2009   6   1
{
                 “_id”:“ABCDEFG”,
                 “_rev”:“1-A1B2C3”,
                 “tag”:“perl couchdb cpan”,
                 “title”:”AnyEvent::CouchDB”,
                 “href”:”http://search.cpan.org/
               ~beppu/AnyEvent-CouchDB/”
               }
2009   6   1
// Map Function
               function(doc) {
                 if(doc.tag.match(/couchdb/i){
                   emit(doc.title, doc.href);
                 }
               }


2009   6   1
Result
2009   6   1
// Map Function
               function(doc) {
                 var tags = doc.tag.split(“ “);
                 for(var i in tags) {
                   emit(tags[i], 1);
                 }
               }
               // Reduce Function
               function(keys, values) {
                 return sum(values);
               }
2009   6   1
Result
2009   6   1
N-Master Replication



2009   6   1
$ curl -X POST --data 
               '{”source”:”http://remote:5984/
               somedb”,”target”:”somedb”}' 
               http://localhost:5984/_replicate



2009   6   1
Replication Complete



2009   6   1
!!!



2009   6   1
2009   6   1
N-Master Replication

               • Master - Slave
               •
               • source, target
               •                  ※




2009   6   1
Demo



2009   6   1
Demo

               • cohtan             Delicious
                                         CouchDB

               •
                   All Document, Design Document, Temporary View, created view




2009   6   1
CouchApp



2009   6   1
CouchApp
               • CouchDB   Design Document
                                                 /
                 Python Framework
               • Python
               •           HTML     JavaScript



2009   6   1
Sofa



2009   6   1
Sofa


               • CouchApp
               • CouchDB


2009   6   1
Demo



2009   6   1
Demo


               • Sofa     Demo




2009   6   1
• Web Application   Fit

               • RESTful JSON
               •
               •
               • Scaffold
2009   6   1
: http://delicious/com/cohtan/couchdb




2009   6   1

Weitere ähnliche Inhalte

Ähnlich wie Couchdb

DLW Europe - JavaScript Tooling
DLW Europe - JavaScript ToolingDLW Europe - JavaScript Tooling
DLW Europe - JavaScript ToolingFabian Jakobs
 
Scylla Summit 2018: Keynote - 4 Years of Scylla
Scylla Summit 2018: Keynote - 4 Years of ScyllaScylla Summit 2018: Keynote - 4 Years of Scylla
Scylla Summit 2018: Keynote - 4 Years of ScyllaScyllaDB
 
Hadoop Map Reduce Arch
Hadoop Map Reduce ArchHadoop Map Reduce Arch
Hadoop Map Reduce Archnextlib
 
Ajax Tutorial
Ajax TutorialAjax Tutorial
Ajax Tutorialoscon2007
 
Yet Another Max/MSP-Cocoa Communication
Yet Another Max/MSP-Cocoa CommunicationYet Another Max/MSP-Cocoa Communication
Yet Another Max/MSP-Cocoa CommunicationNao Tokui
 
Database Performance With Proxy Architectures
Database  Performance With  Proxy  ArchitecturesDatabase  Performance With  Proxy  Architectures
Database Performance With Proxy ArchitecturesPerconaPerformance
 
IronRuby - A brave new world for .Net (NDC2010)
IronRuby - A brave new world for .Net (NDC2010)IronRuby - A brave new world for .Net (NDC2010)
IronRuby - A brave new world for .Net (NDC2010)Ben Hall
 
When To Use Ruby On Rails
When To Use Ruby On RailsWhen To Use Ruby On Rails
When To Use Ruby On Railsdosire
 
MarvinSketch and MarvinView: Tips And Tricks: US UGM 2008
MarvinSketch and MarvinView: Tips And Tricks: US UGM 2008MarvinSketch and MarvinView: Tips And Tricks: US UGM 2008
MarvinSketch and MarvinView: Tips And Tricks: US UGM 2008ChemAxon
 
Web Development: The Next Five Years
Web Development: The Next Five YearsWeb Development: The Next Five Years
Web Development: The Next Five Yearssneeu
 
Novalug 07142012
Novalug 07142012Novalug 07142012
Novalug 07142012Mandi Walls
 
Rails in the Cloud
Rails in the CloudRails in the Cloud
Rails in the Cloudiwarshak
 
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Eugene Yokota
 
Umleitung: a tiny mochiweb/CouchDB app
Umleitung: a tiny mochiweb/CouchDB appUmleitung: a tiny mochiweb/CouchDB app
Umleitung: a tiny mochiweb/CouchDB appLenz Gschwendtner
 
Drupal 6 JavaScript and jQuery
Drupal 6 JavaScript and jQueryDrupal 6 JavaScript and jQuery
Drupal 6 JavaScript and jQueryMatt Butcher
 
CPAN: modules, authors and documentation
CPAN: modules, authors and documentationCPAN: modules, authors and documentation
CPAN: modules, authors and documentationAnatoly Sharifulin
 
Migrating To Ruby1.9
Migrating To Ruby1.9Migrating To Ruby1.9
Migrating To Ruby1.9tomaspavelka
 
Ruby sittin' on the Couch
Ruby sittin' on the CouchRuby sittin' on the Couch
Ruby sittin' on the Couchlangalex
 

Ähnlich wie Couchdb (20)

DLW Europe - JavaScript Tooling
DLW Europe - JavaScript ToolingDLW Europe - JavaScript Tooling
DLW Europe - JavaScript Tooling
 
Scylla Summit 2018: Keynote - 4 Years of Scylla
Scylla Summit 2018: Keynote - 4 Years of ScyllaScylla Summit 2018: Keynote - 4 Years of Scylla
Scylla Summit 2018: Keynote - 4 Years of Scylla
 
Hadoop Map Reduce Arch
Hadoop Map Reduce ArchHadoop Map Reduce Arch
Hadoop Map Reduce Arch
 
Hadoop Map Reduce Arch
Hadoop Map Reduce ArchHadoop Map Reduce Arch
Hadoop Map Reduce Arch
 
Ajax Tutorial
Ajax TutorialAjax Tutorial
Ajax Tutorial
 
Yet Another Max/MSP-Cocoa Communication
Yet Another Max/MSP-Cocoa CommunicationYet Another Max/MSP-Cocoa Communication
Yet Another Max/MSP-Cocoa Communication
 
Database Performance With Proxy Architectures
Database  Performance With  Proxy  ArchitecturesDatabase  Performance With  Proxy  Architectures
Database Performance With Proxy Architectures
 
Practical Groovy DSL
Practical Groovy DSLPractical Groovy DSL
Practical Groovy DSL
 
IronRuby - A brave new world for .Net (NDC2010)
IronRuby - A brave new world for .Net (NDC2010)IronRuby - A brave new world for .Net (NDC2010)
IronRuby - A brave new world for .Net (NDC2010)
 
When To Use Ruby On Rails
When To Use Ruby On RailsWhen To Use Ruby On Rails
When To Use Ruby On Rails
 
MarvinSketch and MarvinView: Tips And Tricks: US UGM 2008
MarvinSketch and MarvinView: Tips And Tricks: US UGM 2008MarvinSketch and MarvinView: Tips And Tricks: US UGM 2008
MarvinSketch and MarvinView: Tips And Tricks: US UGM 2008
 
Web Development: The Next Five Years
Web Development: The Next Five YearsWeb Development: The Next Five Years
Web Development: The Next Five Years
 
Novalug 07142012
Novalug 07142012Novalug 07142012
Novalug 07142012
 
Rails in the Cloud
Rails in the CloudRails in the Cloud
Rails in the Cloud
 
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)
 
Umleitung: a tiny mochiweb/CouchDB app
Umleitung: a tiny mochiweb/CouchDB appUmleitung: a tiny mochiweb/CouchDB app
Umleitung: a tiny mochiweb/CouchDB app
 
Drupal 6 JavaScript and jQuery
Drupal 6 JavaScript and jQueryDrupal 6 JavaScript and jQuery
Drupal 6 JavaScript and jQuery
 
CPAN: modules, authors and documentation
CPAN: modules, authors and documentationCPAN: modules, authors and documentation
CPAN: modules, authors and documentation
 
Migrating To Ruby1.9
Migrating To Ruby1.9Migrating To Ruby1.9
Migrating To Ruby1.9
 
Ruby sittin' on the Couch
Ruby sittin' on the CouchRuby sittin' on the Couch
Ruby sittin' on the Couch
 

Couchdb

  • 1. CouchDB relax Kota Sakoda 2009 6 1
  • 2. cohtan ( Kota Sakoda ) • • • • • codecheck.in 2009 6 1
  • 3. Agenda • DB CouchDB • 2009 6 1
  • 4. What’s CouchDB? • Erlang DB • Not Relational! • RESTful API • SQL MapReduce • N-Master Replication 2009 6 1
  • 6. Erlang • • • 0.9.0 11067 ! ($ cat src/couchdb/*.erl | wc) 2009 6 1
  • 8. Document Oriented • RDB •1 JSON • JSON • 2009 6 1
  • 9. { “_id”: “ABCDEFG”, “_rev”: “1-AB123C”, “type”: “person”, “name”: “Kota Sakoda”, “age”: 29, “computer”: [”MacBook Air”, “MacBook”, “Inspiron Mini 12”], } 2009 6 1
  • 10. { “_id”: “ABCDEFG”, “_rev”: “2-AB123C”, “type”: “person”, “name”: “Kota Sakoda”, “age”: 29, “computer”: [”MacBook Air”, “MacBook”, “Inspiron Mini 12”, “SC430”], “hobby”:{“program”:[”perl”,”erlang”]} } 2009 6 1
  • 12. RESTful API • Crete HTTP PUT /dbname/docid • Read HTTP GET /dbname/docid • Update HTTP PUT /dbname/docid • Delete HTTP DELETE /dbname/docid 2009 6 1
  • 13. RESTful API • http://wiki.apache.org/couchdb/Basics • Amazon EC2, ExtJS, C, C#, Erlang, Futon, Haskell, Java, JavaScript, LISP, LotusScript, Objective-C, Perl, PHP, Python, Ruby, Smalltalk 2009 6 1
  • 15. MapReduce Framework • JavaScript MapReduce! • Map JSON KeyValue • Reduce KeyValue 2009 6 1
  • 16. { “_id”:“ABCDEFG”, “_rev”:“1-A1B2C3”, “tag”:“perl couchdb cpan”, “title”:”AnyEvent::CouchDB”, “href”:”http://search.cpan.org/ ~beppu/AnyEvent-CouchDB/” } 2009 6 1
  • 17. // Map Function function(doc) { if(doc.tag.match(/couchdb/i){ emit(doc.title, doc.href); } } 2009 6 1
  • 18. Result 2009 6 1
  • 19. // Map Function function(doc) { var tags = doc.tag.split(“ “); for(var i in tags) { emit(tags[i], 1); } } // Reduce Function function(keys, values) { return sum(values); } 2009 6 1
  • 20. Result 2009 6 1
  • 22. $ curl -X POST --data '{”source”:”http://remote:5984/ somedb”,”target”:”somedb”}' http://localhost:5984/_replicate 2009 6 1
  • 24. !!! 2009 6 1
  • 25. 2009 6 1
  • 26. N-Master Replication • Master - Slave • • source, target • ※ 2009 6 1
  • 27. Demo 2009 6 1
  • 28. Demo • cohtan Delicious CouchDB • All Document, Design Document, Temporary View, created view 2009 6 1
  • 30. CouchApp • CouchDB Design Document / Python Framework • Python • HTML JavaScript 2009 6 1
  • 31. Sofa 2009 6 1
  • 32. Sofa • CouchApp • CouchDB 2009 6 1
  • 33. Demo 2009 6 1
  • 34. Demo • Sofa Demo 2009 6 1
  • 35. • Web Application Fit • RESTful JSON • • • Scaffold 2009 6 1