7/31/2019 Slides Couchdb
1/52
Einfhrung in CouchDBZurcklehnen und entspannen!
Thomas Schrader (@slogmen) 12/2010
http://slog.io
http://slog.io/http://slog.io/http://slog.io/7/31/2019 Slides Couchdb
2/52
bersicht
Bestandsaufnahme
Ansatz
Geschichte
Technologien
Features
Skalierbarkeit
Kurz & Gut
Fazit
7/31/2019 Slides Couchdb
3/52
Relationale Datenbanken
in den 70iger Jahren entwickelt
fr groe Rechenanlagen
komplexe Replikation
unflexible, aufwendige Schemas
SQL?
7/31/2019 Slides Couchdb
4/52
NoSQL
Not only SQL
nicht relationale Datenbanken
Graph-Datenbanken
Key-/Value-Datenbanken
Tabellen (BigTable)
Dokumentenorientierte Datenbanken
7/31/2019 Slides Couchdb
5/52
Ansatz
Url Title Descriptionhttp://www.heise.de Heise Online Seite fr IT-News
http://couchdb.org CouchDB Heimat der
Dokumentenorientierten
Datenbank CouchDB
http://fh-trier.de FH Trier Die Fachhochschule in Trier
http://fh-trier.de/http://fh-trier.de/http://fsi.fh-trier.de/http://fsi.fh-trier.de/http://www.heise.de/http://www.heise.de/7/31/2019 Slides Couchdb
6/52
Ansatz
(
Url: http://couchdb.org
Title: CouchDB
Description: Heimat der ... CouchDB
)
7/31/2019 Slides Couchdb
7/52
Ansatz
Schlssel-/Wert Paare
Verzicht auf Schemas: mehr Flexibilitt, einfaches
Design
Passt zu Denkweise fr Objekte in modernen
Objektorientierten Sprachen
7/31/2019 Slides Couchdb
8/52
Geschichte
frhe Doc-DB in Lotus Notes
Damien Katz, Entwickler bei Lotus
CouchDB wird seit 2005 entwickelt
2008-2009 Entwicklung von IBM gefrdert
02/2008 Incubator der Apache Software Foundation
11/2008 vollwertiges Apache Projekt
Apache Software License 2.0, OpenSource!
7/31/2019 Slides Couchdb
9/52
CouchDB
Ziel: Dokumentenorientierten Ansatz aus Notes mitMap/Reduce-Algorithmen verbinden.
Alles einfach halten!
7/31/2019 Slides Couchdb
10/52
Technologien
Erlang
JavaScript
JSON
RESTful API => HTTP!
7/31/2019 Slides Couchdb
11/52
REST
beschreibt eine Architektur
Representational State Transfer
Ressourcen, ber URI identifizierbar
einheitliche Schnittstelle
7/31/2019 Slides Couchdb
12/52
HTTP (CRUD)
Create POST /db/ Retrieve GET /db/docid Update PUT /db/docid Delete DELETE /db/docid
7/31/2019 Slides Couchdb
13/52
JSON
7/31/2019 Slides Couchdb
14/52
JSON
{
"_id": "BC4ea69ce1a73aa7d21d23b608d221d0",
"_rev": "1-967a00dff5e02add41819138abb3284d",
"type": "person",
"name": "Darth Vader",
"age": 63,
"headware": ["Helmet", "Sombrero"],
"dark_side": true
}
7/31/2019 Slides Couchdb
15/52
API
es werden keine speziellen APIs bentigt
HTTP/JSON sind die API
7/31/2019 Slides Couchdb
16/52
API
es werden keine speziellen APIs bentigt
HTTP/JSON sind die API
7/31/2019 Slides Couchdb
17/52
API
es werden keine speziellen APIs bentigt
HTTP/JSON sind die API
7/31/2019 Slides Couchdb
18/52
lokale Konsistenz
Dokumente werden versioniert:
MultiVersion Concurrency Control (MVCC)
Append Only
kein Locking
7/31/2019 Slides Couchdb
19/52
verteilte Konsistenz
C
A
P
Whle 2
RDBMS (MySQL,
Postgres, ...)
BigTable, MongoDB,
MemcacheDB, BerkeleyDB
CouchDB, Cassandra,
SimpleDB
CAP Theorem
7/31/2019 Slides Couchdb
20/52
Eventual Consistency
Verfgbarkeit steht ber Konsistenz
inkrementelle Replikation stellt Konsistenz wieder her
7/31/2019 Slides Couchdb
21/52
Features
Views
MapReduce
Replikation
7/31/2019 Slides Couchdb
22/52
Views
Design-Dokumente
B+ Baum
MapReduce Funktionen
7/31/2019 Slides Couchdb
23/52
MapReduce
{
"id": 1,
"date": 20101201,
"checkout": 100
}
{
"id": 2,
"date": 20101201,
"checkout": 42
}
{
"id": 3,
"date": 20101201,
"checkout": 23
}
{
"id": 4,
"date": 20101201,
"checkout": 10
}
7/31/2019 Slides Couchdb
24/52
MapReduce
{
"id": 1,
"date": 20101201,
"checkout": 100
}
{
"id": 2,
"date": 20101201,
"checkout": 42
}
{
"id": 3,
"date": 20101201,
"checkout": 23
}
{
"id": 4,
"date": 20101201,
"checkout": 10
}
100 42 23 10
7/31/2019 Slides Couchdb
25/52
MapReduce
{
"id": 1,
"date": 20101201,
"checkout": 100
}
{
"id": 2,
"date": 20101201,
"checkout": 42
}
{
"id": 3,
"date": 20101201,
"checkout": 23
}
{
"id": 4,
"date": 20101201,
"checkout": 10
}
100 42 23 10
142 33
7/31/2019 Slides Couchdb
26/52
MapReduce
{
"id": 1,
"date": 20101201,
"checkout": 100
}
{
"id": 2,
"date": 20101201,
"checkout": 42
}
{
"id": 3,
"date": 20101201,
"checkout": 23
}
{
"id": 4,
"date": 20101201,
"checkout": 10
}
100 42 23 10
142 33
175
7/31/2019 Slides Couchdb
27/52
Replikation
Offline per default
es gibt viele Realitten
Event-gesteuert
Konfliktbehandlung
7/31/2019 Slides Couchdb
28/52
7/31/2019 Slides Couchdb
29/52
7/31/2019 Slides Couchdb
30/52
7/31/2019 Slides Couchdb
31/52
7/31/2019 Slides Couchdb
32/52
7/31/2019 Slides Couchdb
33/52
7/31/2019 Slides Couchdb
34/52
7/31/2019 Slides Couchdb
35/52
Konflikt-Behandlung
7/31/2019 Slides Couchdb
36/52
Konflikt-Behandlung
7/31/2019 Slides Couchdb
37/52
Konflikt-Behandlung
7/31/2019 Slides Couchdb
38/52
Skalierbarkeit
horizontal:
Partitionierung (Sharding) mit CouchDB Lounge oder
BigCouch
vertikal:
Verteilen der Last auf viele Rechner
jemand eine Idee?
7/31/2019 Slides Couchdb
39/52
HTTP-Proxy-Server:squid, Apache, nginx, ...
Its HTTP!
7/31/2019 Slides Couchdb
40/52
Kurz & Gut
7/31/2019 Slides Couchdb
41/52
Validatoren
7/31/2019 Slides Couchdb
42/52
CouchApps
7/31/2019 Slides Couchdb
43/52
Performance
7/31/2019 Slides Couchdb
44/52
Security
7/31/2019 Slides Couchdb
45/52
CouchDB, dieAllzweckwaffe?
7/31/2019 Slides Couchdb
46/52
naja, nicht ganz.
7/31/2019 Slides Couchdb
47/52
CouchDB
in CouchDB geht es nicht um Relationen
gengt nicht hohen Konsistenzanforderungen (ebay ...)
aber:
Robust
flexibel
niedrige Lernkurve
7/31/2019 Slides Couchdb
48/52
Referenzen
Ubuntu One
BBC
CERN
7/31/2019 Slides Couchdb
49/52
Let me tell you something: Django maybe built for the Web, but CouchDB is
built of the Web. Ive never seen software
that so completely embraces the
philosophies behind HTTP.
Jacob Kaplan-Moss
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/7/31/2019 Slides Couchdb
50/52
Fragen?
7/31/2019 Slides Couchdb
51/52
Time to RelaxVielen Dank!
7/31/2019 Slides Couchdb
52/52
Quellen
CouchDB, The Definitive Guide OREILLY 2010
Umsetzung einer verteilten Anwendung mit der
dokumentenorientierten Datenbank CouchDB, Lena
Herrmann Juli 2010
Chaosradio Express 125
http://chaosradio.ccc.de/cre125.html
Vortrag Jan Lehnardt NoSQL Berlin
Vortrag Karl Glatz Oktober 2009
Vortrag David Coallier, University Limerick 2010
http://chaosradio.ccc.de/cre125.htmlhttp://chaosradio.ccc.de/cre125.htmlhttp://chaosradio.ccc.de/cre125.html