Vous êtes sur la page 1sur 4

CouchDB

From Wikipedia, the free encyclopedia


Jump to: navigation, search
Apache CouchDB
CouchDB's Futon Administration nterface, !ser data"ase
Original author(s)
Damien #at$, Jan %ehnardt, &oah 'later, Christopher %en$, J( Chris Anderson, )aul Davis, Adam
#ocoloski, Jason Davies, Beno*t Chesneau, Filipe +anana, ,o"ert &e-son
Developer(s) Apache 'oft-are Foundation
Initial release .//0
Stable release 1(0(/ 2 &ovem"er 0, ./13
Development status Active
Written in 4rlang
Operating system Cross5platform
Type Document5oriented data"ase
License Apache %icense
Website couchd"(apache(org
6he LYC (so!t"are bun#le) is "ased on 4rlang and comprises CouchDB( t's entirely composed of free and open5source
soft-are
$pache CouchDB, commonly referred to as CouchDB, is an open source data"ase that focuses on ease of use and on "eing 7a
data"ase that completely em"races the -e"7(819 t is a &o':% data"ase that uses J';& to store data, Java'cript as its <uery
language using +ap,educe, and =66) for an A)(819 ;ne of its distinguishing features is multi5master replication( CouchDB
-as first released in .//0 and later "ecame an Apache pro>ect in .//?(
!nlike in a relational data"ase, CouchDB does not store data and relationships in ta"les( nstead, each data"ase is a collection
of independent documents( 4ach document maintains its o-n data and self5contained schema( An application may access
multiple data"ases, such as one stored on a user's mo"ile phone and another on a server( Document metadata contains revision
information, making it possi"le to merge any differences that may have occurred -hile the data"ases -ere disconnected(
CouchDB implements a form of +ulti5@ersion Concurrency Control A+@CCB in order to avoid the need to lock the data"ase
file during -rites( Conflicts are left to the application to resolve( ,esolving a conflict generally involves first merging data into
one of the documents, then deleting the stale one(8.9
;ther features include document5level ACD semantics -ith eventual consistency, AincrementalB +ap,educe, and
AincrementalB replication( Administration is supported -ith a "uilt5in -e" application called Futon(
Contents
1 =istory
. +ain features
3 !se cases C production deployments
3(1 4nterprises that use CouchDB
D Data manipulation: documents and vie-s
D(1 Accessing data via =66)
0 ;pen source components
E 'ee also
F ,eferences
? Bi"liography
G 4Hternal links
%istory
CouchDB ACouch is an acronym for cluster of unreliable commodity hardwareB839 is a pro>ect created in April .//0 "y
Damien #at$, former %otus &otes developer at B+( Damien #at$ defined it as a 7storage system for a large scale o">ect
data"ase7( =is o">ectives for the data"ase -ere to "ecome the data"ase of the nternet and that it -ould "e designed from the
ground up to serve -e" applications( =e self5funded the pro>ect for almost t-o years and released it as an open source pro>ect
under the I&! Ieneral )u"lic %icense(
n Fe"ruary .//?, it "ecame an Apache ncu"ator pro>ect and the license -as changed to the Apache %icense(8D9 A fe- months
after, it graduated to a top5level pro>ect(809 6his led to the first sta"le version "eing released in July ./1/(8E9
n early ./1., Damien #at$ left the pro>ect to focus on Couch"ase 'erver(8F9
'ince the departure of Damien #at$, the Apache CouchDB pro>ect has continued, releasing 1(. in April ./1. and 1(3 in April
./13( n July ./13, the CouchDB community merged the code"ase for BigCouch, Cloudant's clustered version of CouchDB,
into the Apache pro>ect( 6he BigCouch clustering frame-ork is prepared to "e included in an upcoming release of Apache
CouchDB(8?9
&ain !eatures
Document 'torage
CouchDB stores data as 7documents7, as one or more field2value pairs eHpressed as J';&( Field values can "e simple
things like strings, num"ers, or datesJ "ut ordered lists and associative arrays can also "e used( 4very document in a
CouchDB data"ase has a uni<ue id and there is no re<uired document schema(
ACD 'emantics
CouchDB provides ACD semantics(8G9 t does this "y implementing a form of +ulti5@ersion Concurrency Control,
meaning that CouchDB can handle a high volume of concurrent readers and -riters -ithout conflict(
+ap2,educe @ie-s and ndeHes
6he stored data is structured using vie-s( n CouchDB, each vie- is constructed "y a Java'cript function that acts as the
+ap half of a map2reduce operation( 6he function takes a document and transforms it into a single value -hich it returns(
CouchDB can indeH vie-s and keep those indeHes updated as documents are added, removed, or updated(
Distri"uted Architecture -ith ,eplication
CouchDB -as designed -ith "i5direction replication Aor synchroni$ationB and off5line operation in mind( 6hat means
multiple replicas can have their o-n copies of the same data, modify it, and then sync those changes at a later time(
,4'6 A)
All items have a uni<ue !, that gets eHposed via =66)( ,4'6 uses the =66) methods );'6, I46, )!6 and D4%464
for the four "asic C,!D ACreate, ,ead, !pdate, DeleteB operations on all resources(
4ventual Consistency
CouchDB guarantees eventual consistency to "e a"le to provide "oth availa"ility and partition tolerance(
Built for ;ffline
CouchDB can replicate to devices Alike smartphonesB that can go offline and handle data sync for you -hen the device is
"ack online(
CouchDB also offers a "uilt5in administration interface accessi"le via -e" called Futon(81/9
'se cases ( pro#uction #eployments
,eplication and synchroni$ation capa"ilities of CouchDB make it ideal for using it in mo"ile devices, -here net-ork
connection is not guaranteed "ut the application must keep on -orking offline(
CouchDB is -ell suited for applications -ith accumulating, occasionally changing data, on -hich pre5defined <ueries are to "e
run and -here versioning is important AC,+, C+' systems, "y eHampleB( +aster5master replication is an especially
interesting feature, allo-ing easy multi5site deployments(8119
nterprises that use CouchDB
A fe- eHamples of enterprises that used or are using CouchDB are:
!"untu "egan using it in .//G for its synchroni$ation service 7!"untu ;ne781.9 "ut stopped using it in &ovem"er
./11(8139
6he BBC, for its dynamic content platforms81D9
Credit 'uisse, for internal use at commodities department for their marketplace frame-ork(8109
+ee"o, for their social platform A-e" and applicationsB 5 +ee"o -as ac<uired "y Ioogle and -as shut do-n on July
1., ./1.(
A more comprehensive list of soft-are pro>ects and -e" sites that use CouchDB is availa"le on the Apache pro>ects's -iki81E9
8109
Data manipulation) #ocuments an# vie"s
CouchDB manages a collection of J';& documents( 6he documents are organised via vie-s( @ie-s are defined -ith
aggregate functions and filters are computed in parallel, much like +ap,educe(
@ie-s are generally stored in the data"ase and their indeHes updated continuously( CouchDB supports a vie- system using
eHternal socket servers and a J';&5"ased protocol(81F9 As a conse<uence, vie- servers have "een developed in a variety of
languages AJava'cript is the default, "ut there are also )=), ,u"y, )ython and 4rlangB(
$ccessing #ata via %TT*
Applications interact -ith CouchDB via =66)( 6he follo-ing demonstrates a fe- eHamples using c!,%, a command5line
utility( 6hese eHamples assume that CouchDB is running on localhost A1.F(/(/(1B on port 0G?D(
$ction +e,uest +esponse
Accessing
server
information
curl http://127.0.0.1:5984/
{
"couchdb": "Welcome",
"versio":"1.1.0"
!
Creating a
data"ase
named "i-i
curl "# $%& http://127.0.0.1:5984/'i(i {"o(": true!
Attempting
to create a
second
data"ase
named "i-i
curl "# $%& http://127.0.0.1:5984/'i(i
K
7error7:7fileLeHists7,
7reason7:76he data"ase could not "e created, the file
already eHists(7
M
,etrieve
information
a"out the
"i-i
data"ase
curl http://127.0.0.1:5984/'i(i
{
"db)*me": "'i(i",
"doc)cout": 0,
"doc)del)cout": 0,
"upd*te)se+": 0,
"pur,e)se+": 0,
"comp*ct)rui,": -*lse,
"dis()si.e": 79,
"ist*ce)st*rt)time": "127245/87/091070",
"dis()-orm*t)versio": 5
!
Delete the
data"ase
"i-i
curl "# 1232&2 http://127.0.0.1:5984/'i(i {"o(": true!
Create a
document,
asking
CouchDB
to supply a
document id
curl "# $45& "6 "7otet"&8pe: *pplic*tio/9so" ""d*t* :
;{ "te<t" : "Wi(ipedi* o 7ouch1=", "r*ti,": 5 !; :
http://127.0.0.1:5984/'i(i
{
"o(": true,
"id": "12/=>7",
"rev": "940=7117"
!

Vous aimerez peut-être aussi