35
Introducing CouchDB Tuesday November 11, 2009 Hatem Ben Yacoub

Intro Couchdb

Embed Size (px)

Citation preview

Page 1: Intro Couchdb

Introducing CouchDBTuesday November 11, 2009

Hatem Ben Yacoub

Page 2: Intro Couchdb

Who am I ?

● Hatem Ben Yacoub● IT Consultant● Senior Systems Architect● PHP Expert● e-Government Specialist● Energy Engineer● Open Source Evangelist● http://phpmagazine.net ● [email protected] / @hatem / http://hatem.tel

Page 3: Intro Couchdb

How to build faster, bigger, reliable websites...

Page 4: Intro Couchdb

Scalability

Page 5: Intro Couchdb

Scalability

~==

Database optimization

Page 6: Intro Couchdb

RDBMS … old fashion

Page 7: Intro Couchdb

… new fashion ??

Page 8: Intro Couchdb

NoSQL

“Not Only SQL”

Page 9: Intro Couchdb

Scaling writes

&

Scaling reads

Page 10: Intro Couchdb

NoSQL

Non-Distributed databases(Redis, MongoDB,CouchDB, Neo4j,Tokyo cabinet ...)

Distributed Databases(Cassandra, Hbase,

Riak, Scalaris...)

Page 11: Intro Couchdb
Page 12: Intro Couchdb

CouchDB is NOT

● A relational database.● A replacement for relational databases.● An object-oriented database.

Page 13: Intro Couchdb

CouchDB is

● OpenSource Database● RESTful API● Schema-less document store (document in JSON

format)● Multi-Version-Concurrency-Control model● User-defined query structured as map/reduce● Incremental Index Update mechanism● Multi-Master Replication model● Written in Erlang

Page 14: Intro Couchdb

Let's give it a try

Ubuntu 9.10 already uses couchdb (all POSIX systems supported)

Install the database server :

$sudo apt-get install couchdb

Page 15: Intro Couchdb

Test installation

Page 16: Intro Couchdb

CouchDB port 5984

Page 17: Intro Couchdb

CouchDB Management interface (Futon)

Page 18: Intro Couchdb

Create database test

Page 19: Intro Couchdb

Firebug

Page 20: Intro Couchdb

Creating a document with jQuery

// server respond with JSON also :// {"ok":true,"id":"323409622afb6477e7108684785256b8","rev":"1-3182c819b0f98858c54ad920d6c44498"}// including the document id and revision, and a confirmation variable ok=true

Page 21: Intro Couchdb

How to request this document ?

// response is also in JSON :// {"_id":"323409622afb6477e7108684785256b8","_rev":"1-3182c819b0f98858c54ad920d6c44498","Name":"Makkah","Zip":21955}

Page 22: Intro Couchdb

What about updating ?

// notice in the response we have revision changed to 2// {"ok":true,"id":"323409622afb6477e7108684785256b8","rev":"2-03779debc847f783493a69e61bd98560"}

Page 23: Intro Couchdb

What about creating a view ?

// Server respond with {"ok":true,"id":"_design/render","rev":"1-f95a9b997f1081043fda1a34be76c47e"}

http://127.0.0.1:5984/test/_design/render/_show/code/480f17c996bcbd174ac64b976de47f79

Page 24: Intro Couchdb

Easy ?!

Page 25: Intro Couchdb

Why CouchDB

● Easy to use data storage (NoSQL)● Easy to integrate with web applications :

JavaScript, JSON● Scalability for large web applications :

Incremental Replication, bi-directional conflict detection and management

● Query-able and index-able● Offline by default

Page 26: Intro Couchdb

Who's using CouchDB ?

Page 27: Intro Couchdb

Relax

Page 28: Intro Couchdb
Page 29: Intro Couchdb

Ubuntu OneUbuntu : 10 million desktops worldwide

Page 30: Intro Couchdb
Page 31: Intro Couchdb

Loungeproxy-based partitioning/clustering framework

Page 32: Intro Couchdb

Mozilla RaindropNew messaging platform built on top of CouchDB

Page 33: Intro Couchdb

Thank you

Page 34: Intro Couchdb

Read more ...

● http://couchdb.org● http://planet.couchdb.org● http://horicky.blogspot.com/2008/10/couchdb-implementation.html● http://jan.prima.de ● http://damienkatz.net/ ● http://jchrisa.net

Page 35: Intro Couchdb

Questions ?