31
No SQL? No Driver? No Application Server? No Problem! Elmar Schraml [email protected]

No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

No SQL? No Driver? No Application Server?No Problem!

Elmar Schraml [email protected]

Page 2: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

Who am I ?

@elmarschraml

adesso AG Enterprise Java, web services,... Closet web enthusiast

In Munich: - JUGM - GTUGMUC

Page 3: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

Agenda

1) NoSQL –why?

2) CouchDB -what and how

3) CouchApps -cool!

Page 4: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

History of Databases

1970s – Relational Databases

Page 5: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

History of Databases

1980s – Nothing much happens

Page 6: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

History of Databases

1990s – Nothing much happens

Page 7: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

History of Databases

2000s – Nothing much happens

NoSQL

Page 8: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

Why - Scaling

Relational Databases at Web scale

Page 9: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

CAP Theory

Page 10: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

Why – Object Storage

Page 11: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

Why – Object Storage

Page 12: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

NoSQL - who?

Page 13: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

CouchDB - who?

Damien Katz

Page 14: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

CouchDB – data format

Page 15: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

CouchDB – data format

{ "_id": "sdjkdf3892kle23", "_rev": "3-sdfs34", "type": "person", "name": "Elmar", "age": 29, "preferred_hardware": ["macbook","iphone","kindle"] "geek": true }

Page 16: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

CouchDB - protocol

HTTP as native protocol

Use existing tools

REST assured

„MySQL is built FOR the web,CouchDB is built OF the web“

NO DRIVER

Page 17: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

CouchDB - API

Create -> PUT /mydb/docid Read -> GET /mydb/docid Update -> POST /mydb/docid Delete -> DELETE /mydb/docid

Example:curl -X PUT http://localhost:5984/allmyshinythings -d

'<insert json string here>'

Page 18: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

CouchDB - Views

map: function(doc) { if(doc.firstname) { emit(doc.firstname, doc) } }

Reduce: function(keys,values,rereduce){ return sum(values) }

NO SQL

Page 19: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

Web applications

HTTP interface

Routing

CRUD operations

Validation

Render Html interface ...... let's see....

Page 20: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

CouchDB – show functions

Page 21: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

CouchDB – list functions

Page 22: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

CouchDB - CouchApp

Deployment script

Templating functions

Jquery Plugin

NO APPLICATION

SERVER

Page 23: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

I CAN HAZ

APPSERVER

IN MY

COUCH !?!

Page 24: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

CouchDB - Replication

curl -X POST http://localhost:5984/_replicate'{"source":"/somedb","target":"http://theotherguy.org:5984/somedb","continuous":true}'

Page 25: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

CouchDB - Replication

Page 26: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

CouchDB - Replication

Page 27: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

CouchDB - Replication

Page 28: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

CouchDB - Replication

Page 29: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

State of the CouchDB

1.0 out in Aug 2010 CouchIO Hosting services GeoCouch for GIS Lounge for Clustering 20+ CouchApps Several books coming

Page 30: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

What for?

- object persistence: no more hibernate

- Document storage: no more “big chunk of xml in a clobcolumn”

- Data sync: poor man’s dropbox

- Couch apps: “view source” for webapps

Page 31: No SQL? No Driver? No Application Server? No Problem! fileCouchDB - protocol HTTP as native protocol Use existing tools REST assured „MySQL is built FOR the web, CouchDB is built

More?

couchdb.apache.org

couchapp.org

guide.couchdb.org

[email protected]

@elmarschraml

THANKS