CouchDB Tour - Fosdem 2010

Embed Size (px)

Citation preview

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    1/69

    CouchDB tourBenot Chesneau

    07/02/2010 FOSDEM 2010

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    2/69

    [email protected], Couchbeam &Couchdbkit maintainer

    Web craftmanminimal web & opensource

    benot chesneau

    Monday, February 8, 2010

    mailto:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]
  • 8/14/2019 CouchDB Tour - Fosdem 2010

    3/69

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    4/69

    WHY COUCHDB ?

    Document oriented

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    5/69

    WHY COUCHDB ?

    Document oriented

    HTTP native

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    6/69

    WHY COUCHDB ?

    Document oriented

    HTTP native

    Local Data

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    7/69

    WHY COUCHDB ?

    Document oriented

    HTTP native

    Local Data

    P2P Applications

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    8/69

    WHY COUCHDB ?

    Document oriented

    HTTP native

    Local Data

    P2P Applications

    Scale

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    9/69

    COUCHDB

    DESIGNED FOR THE FUTUR

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    10/69

    COUCHDB

    DESIGNED FOR THE FUTUR

    Erlang OTP

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    11/69

    COUCHDB

    DESIGNED FOR THE FUTUR

    Erlang OTP

    Append Only File Structure

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    12/69

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    13/69

    COUCHDB

    DESIGNED FOR THE FUTUR

    Erlang OTP

    Append Only File Structure

    Crash tolerance

    HTTP

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    14/69

    DocumentOriented

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    15/69

    DOCUMENT JSON

    {

    "_id": "foo", "_rev": "1-....",

    "url": "http://apache.couchdb.org",

    "vote": 1

    }

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    16/69

    HTTP NATIVE

    CouchDB is built

    ofthe Web.

    Jacob Kaplan-Moss - http://jacobian.org/writing/of-the-web/

    Monday, February 8, 2010

    http://jacobian.org/writing/of-the-web/http://jacobian.org/writing/of-the-web/http://jacobian.org/writing/of-the-web/http://jacobian.org/writing/of-the-web/
  • 8/14/2019 CouchDB Tour - Fosdem 2010

    17/69

    API HTTP RESTGET / HTTP/1.1\r\nHost: 127.0.0.1:5984\r\n\r\n"

    {"couchdb":"Welcome","version":"0.11.0b6ba76f83-git"}

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    18/69

    API HTTP REST

    Web paradigm

    GET / HTTP/1.1\r\nHost: 127.0.0.1:5984\r\n\r\n"

    {"couchdb":"Welcome","version":"0.11.0b6ba76f83-git"}

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    19/69

    API HTTP REST

    Web paradigm

    Supported everywhere

    GET / HTTP/1.1\r\nHost: 127.0.0.1:5984\r\n\r\n"

    {"couchdb":"Welcome","version":"0.11.0b6ba76f83-git"}

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    20/69

    API HTTP REST

    Web paradigm

    Supported everywhere

    Lot of available tools/libs

    GET / HTTP/1.1\r\nHost: 127.0.0.1:5984\r\n\r\n"

    {"couchdb":"Welcome","version":"0.11.0b6ba76f83-git"}

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    21/69

    MAP/REDUCE

    http://wiki.apache.org/couchdb/Using_Views

    Monday, February 8, 2010

    http://wiki.apache.org/couchdb/Using_Viewshttp://wiki.apache.org/couchdb/Using_Views
  • 8/14/2019 CouchDB Tour - Fosdem 2010

    22/69

    MAP/REDUCE

    Map/Reduce to extract informations from documents

    http://wiki.apache.org/couchdb/Using_Views

    Monday, February 8, 2010

    http://wiki.apache.org/couchdb/Using_Viewshttp://wiki.apache.org/couchdb/Using_Views
  • 8/14/2019 CouchDB Tour - Fosdem 2010

    23/69

    MAP/REDUCE

    Map/Reduce to extract informations from documents

    Javascript used to map documents

    http://wiki.apache.org/couchdb/Using_Views

    Monday, February 8, 2010

    http://wiki.apache.org/couchdb/Using_Viewshttp://wiki.apache.org/couchdb/Using_Views
  • 8/14/2019 CouchDB Tour - Fosdem 2010

    24/69

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    25/69

    MAP/REDUCE

    Map/Reduce to extract informations from documents

    Javascript used to map documents Design Doc

    /db/_design/ddocname/_view

    http://wiki.apache.org/couchdb/Using_Views

    Monday, February 8, 2010

    http://wiki.apache.org/couchdb/Using_Viewshttp://wiki.apache.org/couchdb/Using_Views
  • 8/14/2019 CouchDB Tour - Fosdem 2010

    26/69

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    27/69

    MAP.JSfunction(doc) { if(doc.url&&doc.vote)

    emit(doc.url, doc.vote);

    }

    {

    "total_rows":3,

    "offset":0,

    "rows":[

    {

    "id":"15c92051cc81d564db4337a05087bc8d",

    "key":"http://apache.couchdb.org",

    "value":1

    },

    {

    "id":"fa9658810d25cac893748e4ff15e7253",

    "key":"http://apache.couchdb.org",

    "value":1

    },

    {

    "id":"1fa0c68d8455196507b8b01645e65186",

    "key":"http://mysql.com",

    "value":-1

    }]}

    json

    result

    Monday, February 8, 2010

    http://mysql.com/http://mysql.com/http://apache.couchdb.org/http://apache.couchdb.org/http://apache.couchdb.org/http://apache.couchdb.org/
  • 8/14/2019 CouchDB Tour - Fosdem 2010

    28/69

    REDUCE.JS

    function(keys, values, rereduce) {

    return sum(values);

    }

    {

    "rows":[

    {

    "key":"http://mysql.com",

    "value":-1

    },

    {

    "key":"http://apache.couchdb.org",

    "value":2

    }

    ]}

    json

    result

    Monday, February 8, 2010

    http://apache.couchdb.org/http://apache.couchdb.org/http://mysql.com/http://mysql.com/
  • 8/14/2019 CouchDB Tour - Fosdem 2010

    29/69

    http://wiki.apache.org/couchdb/Basics

    Monday, February 8, 2010

    http://wiki.apache.org/couchdb/Basicshttp://wiki.apache.org/couchdb/Basics
  • 8/14/2019 CouchDB Tour - Fosdem 2010

    30/69

    Futon

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    31/69

    DEPLOY

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    32/69

    DEPLOY

    Replication

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    33/69

    DEPLOY

    Replication

    Failover

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    34/69

    DEPLOY

    Replication

    Failover

    Clustering

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    35/69

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    36/69

    REPLICATION

    Incremental P2P replication

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    37/69

    REPLICATION

    Incremental P2P replication

    Updates notifications & _changes

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    38/69

    REPLICATION

    Incremental P2P replication

    Updates notifications & _changes

    Take your data with you

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    39/69

    INCREMENTAL

    REPLICATION

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    40/69

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    41/69

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    42/69

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    43/69

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    44/69

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    45/69

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    46/69

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    47/69

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    48/69

    CONTROL YOUR DATA

    document design

    map/reduce

    return HTM or any format (latex,csv, ...)

    couchapp

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    49/69

    RENDER A JSON

    DOC IN HTML

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    50/69

    No db impact

    cacheable

    Render in HTML or any format

    SHOW

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    51/69

    RENDER A VIEW IN HTML

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    52/69

    1 line at a time

    no impact in RAM

    Render in HTML or any format

    LIST

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    53/69

    VALIDATION

    On update

    Per doc

    Via a javascript function

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    54/69

    EXTEND

    External

    HTTP Handlers

    Daemons

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    55/69

    HANDLERS DAEMONS

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    56/69

    HANDLERS, DAEMONS,

    NOTFICATIONS Extends the CouchDB API with your own handlers : http or

    authentification

    Add HTTP services (bonjour, dbus, ..)

    Notifications: stdin/stdout.

    couchdb-lucene, geocouch, ...

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    57/69

    standalone CouchDB applications

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    58/69

    COUCHAPPS

    P2P web

    Local Data

    Offline mode

    Decentralize exchanges

    Script : couchapp

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    59/69

    COUCHAPP

    couchapp generate myapp

    couchapp push mydb

    couchapp clone http://benoitc.im/b/_design/blog

    http://github.com/couchapp/couchapp

    Monday, February 8, 2010

    http://benoitc.im/b/_design/bloghttp://github.com/couchapp/couchapphttp://github.com/couchapp/couchapphttp://benoitc.im/b/_design/bloghttp://benoitc.im/b/_design/blog
  • 8/14/2019 CouchDB Tour - Fosdem 2010

    60/69

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    61/69

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    62/69

    COUCHDB DESKTOP

    On ubuntu karmic

    Soon in your favorite os...

    On your phone

    Monday, February 8, 2010

    Stuart Langridge - Canonical

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    63/69

    ! !

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    64/69

    OrientDocument

    offline

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    65/69

    THE FUTURE

    Permissions managements (trunk)

    Native clustering

    CouchApps improved. CommonJS ?

    Rest API improved (webmachine?)

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    66/69

    GO FURTHER

    COUCHDB : http://couchdb.apache.org

    book : http://books.couchdb.org/relax

    couchapp wiki : http://wiki.github.com/couchapp/couchapp

    irc #couchdb-fr sur freenodes

    Enki multimedia : http://www.e-engura.com

    Monday, February 8, 2010

    http://www.e-engura.com/http://wiki.github.com/couchapp/couchapphttp://books.couchdb.org/relaxhttp://www.e-engura.com/http://www.e-engura.com/http://wiki.github.com/couchapp/couchapphttp://wiki.github.com/couchapp/couchapphttp://books.couchdb.org/relaxhttp://books.couchdb.org/relaxhttp://couchdb.apache.org/http://couchdb.apache.org/
  • 8/14/2019 CouchDB Tour - Fosdem 2010

    67/69

    Questions

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    68/69

    Monday, February 8, 2010

  • 8/14/2019 CouchDB Tour - Fosdem 2010

    69/69

    Cette cration est mise disposition selon le ContratPaternit 2.0 France disponible en ligne http://

    creativecommons.org/licenses/by/2.0/fr/ ou par courrierpostal Creative Commons, 171 Second Street, Suite

    300, San Francisco, California 94105, USA.

    http://creativecommons.org/licenses/by/2.0/fr/http://creativecommons.org/licenses/by/2.0/fr/http://creativecommons.org/licenses/by/2.0/fr/http://creativecommons.org/licenses/by/2.0/fr/