Apache CouchDB: Difference between revisions

Content deleted Content added
→‎Enterprises that use CouchDB: added a cite web template
m Minor corrections
Line 4:
| screenshot = [[File:Couchdb screenshot.png|300px]]
| caption = CouchDB's Futon Administration Interface, User database
| collapsible =
| author = Damien Katz, Jan Lehnardt, Noah Slater, Christopher Lenz, J. Chris Anderson, Paul Davis, Adam Kocoloski, Jason Davies, Benoît Chesneau, Filipe Manana, Robert Newson
| developer = [[Apache Software Foundation]]
Line 22:
}}
 
'''Apache CouchDB''', commonly referred to as '''CouchDB''', is an [[Open-source software|open source]] database that focuses on ease of use and on being "a database that completely embraces the webWeb".<ref name="official-website">{{cite web|last=Apache Software Foundation|title=Apache CouchDB|url=http://couchdb.apache.org/|accessdate=15 April 2012}}</ref> It is a [[Document-oriented database|document-oriented]] [[NoSQL]] database that uses [[JSON]] to store data, [[JavaScript]] as its query language using [[MapReduce]], and [[HTTP]] for an [[API]].<ref name=official-website/> CouchDB was first released in 2005 and later became an [[Apache Software Foundation|Apache]] project in 2008.
 
Unlike a [[relational database]], CouchDB does not store data and relationships in tables. Instead, each database is a collection of independent documents. Each document maintains its own data and self-contained schema. An application may access multiple databases, such as one stored on a user's mobile phone and another on a server. Document metadata contains revision information, making it possible to merge any differences that may have occurred while the databases were disconnected.
Line 28:
CouchDB implements a form of Multi-Version Concurrency Control ([[Multiversion concurrency control|MVCC]]) in order to avoid the need to lock the database file during writes. Conflicts are left to the application to resolve. Resolving a conflict generally involves first merging data into one of the documents, then deleting the stale one.<ref>{{cite web|last=Smith|first=Jason|title=What is the CouchDB replication protocol? Is it like Git?|url=http://stackoverflow.com/a/4766398/395287|work=StackOverflow|publisher=Stack Exchange|accessdate=14 April 2012}}</ref>
 
Other features include document-level [[ACID]] semantics with [[eventual consistency]], (incremental) [[MapReduce]], and (incremental) replication. One of its distinguishing features is [[multi-master replication]], which allows it to scale across machines to build high performance systems. Administration is supported with a built-in webWeb application called Futon.
 
== History ==
'''CouchDB''' (''Couch'' is an acronym for ''cluster of unreliable commodity hardware'')<ref>[http://www.ibm.com/developerworks/opensource/library/os-couchdb/index.html Exploring CouchDB], article from IBM Developer Works</ref> is a project created in April 2005 by [[Damien Katz]], former [[Lotus Notes]] developer at [[IBM]]. Damien Katz defined it as a "storage system for a large scale object database". His objectives for the database were to become the database of the Internet and that it would be designed from the ground up to serve webWeb applications. He self-funded the project for almost two years and released it as an open source project under the [[GNU General Public License]].
 
In February 2008, it became an [[Apache Incubator]] project and the license was changed to the [[Apache License]].<ref>[http://mail-archives.apache.org/mod_mbox/incubator-general/200802.mbox/%3c3d4032300802121136p361b52ceyfc0f3b0ad81a1793@mail.gmail.com%3e Apache mailing list announcement] on mail-archives.apache.org</ref> A few months after, it graduated to a top-level project.<ref>[http://mail-archives.apache.org/mod_mbox/incubator-couchdb-dev/200811.mbox/%3c3F352A54-5FC8-4CB0-8A6B-7D3446F07462@jaguNET.com%3e Re: Proposed Resolution: Establish CouchDB TLP] on mail-archives.apache.org</ref> This led to the first stable version being released in July 2010.<ref>[http://www.pcworld.com/businesscenter/article/201046/couchdb_nosql_database_ready_for_production_use.html "CouchDB NoSQL Database Ready for Production Use"], article from PC World of Jully 2010</ref>
Line 40:
 
== Main features ==
; Document Storage
: CouchDB stores data as "documents", as one or more field/value pairs expressed as [[JSON]]. Field values can be simple things like strings, numbers, or dates; but [[Array data structure|ordered lists]] and [[associative array]]s can also be used. Every document in a CouchDB database has a unique id and there is no required document schema.
; ACID Semantics
: CouchDB provides [[atomicity, consistency, isolation, durability|ACID]] semantics.<ref name="ACID">[http://couchdb.apache.org/docs/overview.html CouchDB, Technical Overview]</ref> It does this by implementing a form of [[Multi-Version Concurrency Control]], meaning that CouchDB can handle a high volume of concurrent readers and writers without conflict.
; Built for Offline
; Map/Reduce Views and Indexes
: CouchDB can replicate to devices (like smartphones) that can go offline and handle data sync for you when the device is back online.
: The stored data is structured using views. In CouchDB, each view is constructed by a [[JavaScript]] function that acts as the Map half of a [[map (higher-order function)|map]]/reduce operation. The function takes a document and transforms it into a single value which it returns. CouchDB can index views and keep those indexes updated as documents are added, removed, or updated.
; Distributed Architecture with Replication
: CouchDB was designed with bi-direction replication (or synchronization) and off-line operation in mind. That means multiple replicas can have their own copies of the same data, modify it, and then sync those changes at a later time.
; Document Storage
; REST API
: CouchDB stores data as "documents", as one or more field/value pairs expressed as [[JSON]]. Field values can be simple things like strings, numbers, or dates; but [[Array data structure|ordered lists]] and [[associative array]]s can also be used. Every document in a CouchDB database has a unique id and there is no required document schema.
: All items have a unique URI that gets exposed via HTTP. [[REST]] uses the [[Hypertext Transfer Protocol#Request methods|HTTP methods]] POST, GET, PUT and DELETE for the four basic [[Create, read, update and delete|CRUD]] (Create, Read, Update, Delete) operations on all resources.
; Eventual Consistency
: CouchDB guarantees [[eventual consistency]] to be able to provide both availability and partition tolerance.
; Map/Reduce Views and Indexes
; Built for Offline
: The stored data is structured using views. In CouchDB, each view is constructed by a [[JavaScript]] function that acts as the Map half of a [[map (higher-order function)|map]]/reduce operation. The function takes a document and transforms it into a single value whichthat it returns. CouchDB can index views and keep those indexes updated as documents are added, removed, or updated.
: CouchDB can replicate to devices (like smartphones) that can go offline and handle data sync for you when the device is back online.
; REST API
: All items have a unique URI that gets exposed via HTTP. [[REST]] uses the [[Hypertext Transfer Protocol#Request methods|HTTP methods]] POST, GET, PUT and DELETE for the four basic [[Create, read, update and delete|CRUD]] (Create, Read, Update, Delete) operations on all resources.
 
CouchDB also offers a built-in administration interface accessible via webWeb called Futon.<ref>[http://guide.couchdb.org/draft/tour.html#welcome "Welcome to Futon"] from "CouchDB The Definitive Guide"</ref>
 
== Use cases & production deployments ==
Replication and synchronization capabilities of CouchDB make it ideal for using it in mobile devices, where network connection is not guaranteed, but the application must keep on working offline.
 
CouchDB is well suited for applications with accumulating, occasionally changing data, on which pre-defined queries are to be run and where versioning is important (CRM, CMS systems, by example). Master-master replication is an especially interesting feature, allowing easy multi-site deployments.<ref name="Analyse Kristof Kovacs">[http://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis Cassandra vs MongoDB vs CouchDB vs Redis vs Riak vs HBase comparison] from Kristóf Kovács</ref>
Line 66:
The following is a list of notable enterprises that have used or are using CouchDB:
* [[Amadeus IT Group]], for some of their back-end systems.{{cn|date=June 2015}}
* [[Credit Suisse]], for internal use at commodities department for their marketplace framework.<ref name="couchdbinthewild">[http://wiki.apache.org/couchdb/CouchDB_in_the_wild "CouchDB in the wild"] article of the product's webWeb, a list of software projects and websites using CouchDB</ref>{{better source needed|reason=Given source is a wiki. See WP:SPS.|date=June 2015}}
* [[Ubuntu (operating system)|Ubuntu]] began using it in 2009 for its synchronization service "Ubuntu One"<ref>[http://mail-archives.apache.org/mod_mbox/couchdb-dev/200910.mbox/%3C4AD53996.3090104@canonical.com%3E Email from Elliot Murphy (Canonical)] to the CouchDB-Devel list</ref> but stopped using it in November 2011.<ref>[http://linux.slashdot.org/story/11/11/22/171228/canonical-drops-couchdb-from-ubuntu-one Canonical Drops CouchDB From Ubuntu One (Slashdot)]</ref>
* [[Meebo]], for their social platform (webWeb and applications).{{cn|date=January 2016}} Meebo was acquired by Google and most products were shut down on July 12, 2012.<ref>{{cite web|url=http://techcrunch.com/2012/06/09/meebo-product-shutdown/ |title=Meebo Gets The Classic Google Acq-hire Treatment: Most Products To Shut Down Soon |first=Kim-Mai |last=Cutler |date=9 June 2012|accessdate=7 January 2016|work=TechCrunch|publisher=AOL Inc.}}</ref>
* The [[BBC]], for its dynamic content platforms.<ref>[http://www.erlang-factory.com/conference/London2009/speakers/endafarrell CouchDB at the BBC as a fault tolerant, scalable, multi-data center key-value store]</ref>
* [[npm (software)|NPM]], for their package registry.<ref>{{cite web|url=https://github.com/npm/npm-registry-couchapp|title=npm-registry-couchapp|website=GitHub|publisher=npm|date=17 June 2015|accessdate=7 January 2016}}</ref>
* [[Credit Suisse]], for internal use at commodities department for their marketplace framework.<ref name="couchdbinthewild">[http://wiki.apache.org/couchdb/CouchDB_in_the_wild "CouchDB in the wild"] article of the product's web, a list of software projects and websites using CouchDB</ref>{{better source needed|reason=Given source is a wiki. See WP:SPS.|date=June 2015}}
* [[Meebo]], for their social platform (web and applications).{{cn|date=January 2016}} Meebo was acquired by Google and most products were shut down on July 12, 2012.<ref>{{cite web|url=http://techcrunch.com/2012/06/09/meebo-product-shutdown/ |title=Meebo Gets The Classic Google Acq-hire Treatment: Most Products To Shut Down Soon |first=Kim-Mai |last=Cutler |date=9 June 2012|accessdate=7 January 2016|work=TechCrunch|publisher=AOL Inc.}}</ref>
* [[Sophos]], for some of their back-end systems.{{cn|date=June 2015}}
* The [[BBC]], for its dynamic content platforms.<ref>[http://www.erlang-factory.com/conference/London2009/speakers/endafarrell CouchDB at the BBC as a fault tolerant, scalable, multi-data center key-value store]</ref>
* [[npm (software)|NPM]], for their package registry.<ref>{{cite web|url=https://github.com/npm/npm-registry-couchapp|title=npm-registry-couchapp
* [[Ubuntu (operating system)|Ubuntu]] began using it in 2009 for its synchronization service "Ubuntu One",<ref>[http://mail-archives.apache.org/mod_mbox/couchdb-dev/200910.mbox/%3C4AD53996.3090104@canonical.com%3E Email from Elliot Murphy (Canonical)] to the CouchDB-Devel list</ref> but stopped using it in November 2011.<ref>[http://linux.slashdot.org/story/11/11/22/171228/canonical-drops-couchdb-from-ubuntu-one Canonical Drops CouchDB From Ubuntu One (Slashdot)]</ref>
|website=GitHub|publisher=npm|date=17 June 2015|accessdate=7 January 2016}}</ref>
 
== Data manipulation: documents and views ==
Line 82 ⟶ 81:
Applications interact with CouchDB via HTTP. The following demonstrates a few examples using [[cURL]], a command-line utility. These examples assume that CouchDB is running on [[localhost]] (127.0.0.1) on port 5984.
 
{| class="wikitable"
|-
! Action !! Request !! Response
|-
| Accessing server information
|| <syntaxhighlight lang="bash">curl http://127.0.0.1:5984/</syntaxhighlight>
|| <syntaxhighlight lang="javascript">{
"couchdb": "Welcome",
Line 94 ⟶ 93:
|-
| Creating a database named '''wiki'''
|| <syntaxhighlight lang="bash">curl -X PUT http://127.0.0.1:5984/wiki</syntaxhighlight>
|| <syntaxhighlight lang="javascript">{"ok": true}</syntaxhighlight>
|-
| Attempting to create a second database named '''wiki'''
|| <syntaxhighlight lang="bash">curl -X PUT http://127.0.0.1:5984/wiki</syntaxhighlight>
|| <syntaxhighlight lang="javascript" enclose="div">{
"error":"file_exists",
Line 105 ⟶ 104:
|-
|| Retrieve information about the '''wiki''' database
|| <syntaxhighlight lang="bash">curl http://127.0.0.1:5984/wiki</syntaxhighlight>
|| <syntaxhighlight lang="javascript">{
"db_name": "wiki",
Line 119 ⟶ 118:
|-
| Delete the database '''wiki'''
| <syntaxhighlight lang="bash">curl -X DELETE http://127.0.0.1:5984/wiki</syntaxhighlight>
| <syntaxhighlight lang="javascript">{"ok": true}</syntaxhighlight>
|-
Line 141 ⟶ 140:
! License
|-
| [[SpiderMonkeyErlang (JavaScriptprogramming enginelanguage)|SpiderMonkeyErlang]]
| Erlang is a general-purpose [[concurrent computing|concurrent]] [[programming language]] and [[Run time system|runtime]] system. The sequential subset of Erlang is a [[functional language]], with [[strict evaluation]], [[single assignment]], and [[dynamic typing]].
| SpiderMonkey is a code name for the first ever [[JavaScript engine]], written by [[Brendan Eich]] at [[Netscape Communications Corporation|Netscape Communications]], later released as open source and now maintained by the [[Mozilla Foundation]].
| Modified [[Mozilla Public License|MPL]]<!--2 1.0?, SpiderMonkey[[Apache wasLicense|Apache pre-MPLLicense 2.0,]] but(Release did they use an18.0 updatedand version?-->later)
|-
| [[International Components for Unicode|ICU]]
| International Components for Unicode (ICU) is an [[open source]] project of mature [[C (programming language)|C]]/[[C++]] and [[Java (programming language)|Java]] libraries for [[Unicode]] support, software [[internationalization]] and software globalization. ICU is widely portable to many operating systems and environments.
|-
| [[jQuery]]
| jQuery is a lightweight [[cross-browser]] [[JavaScript library]] that emphasizes interaction between [[JavaScript]] and [[HTML]].
| [[Dual license]]: [[GNU General Public License|GPL]] and [[MIT License|MIT]]
|-
| [[International Components for Unicode|ICU]]
| International Components for Unicode (ICU) is an [[open source]] project of mature [[C (programming language)|C]]/[[C++]] and [[Java (programming language)|Java]] libraries for [[Unicode]] support, software [[internationalization]] and software globalization. ICU is widely portable to many operating systems and environments.
| [[MIT License]]
|-
| [[OpenSSL]]
| OpenSSL is an [[open source]] implementation of the [[Transport Layer Security|SSL and TLS]] protocols. The core [[library (computer science)|library]] (written in the [[C (programming language)|C programming language]]) implements the basic [[cryptography|cryptographic]] functions and provides various utility functions.
| [[Apache License|Apache]]-like unique
|-
| [[ErlangSpiderMonkey (programmingJavaScript languageengine)|ErlangSpiderMonkey]]
| SpiderMonkey is a code name for the first ever [[JavaScript engine]], written by [[Brendan Eich]] at [[Netscape Communications Corporation|Netscape Communications]], later released as open source and now maintained by the [[Mozilla Foundation]].
| Erlang is a general-purpose [[concurrent computing|concurrent]] [[programming language]] and [[Run time system|runtime]] system. The sequential subset of Erlang is a [[functional language]], with [[strict evaluation]], [[single assignment]], and [[dynamic typing]].
| Modified [[Mozilla Public License|MPL]] 1<!--2.0,? [[ApacheSpiderMonkey License|Apachewas Licensepre-MPL 2.0]], (Releasebut 18.0did they use an andupdated later)version?-->
|}
 
== See also ==
{{Portal|Free software}}
{{too many see alsos|date=April 2015}}
* [[LYCE (software bundle)]]
* [[Apache Accumulo|Accumulo]]
* [[BigCouch]]
* [[Oracle NoSQL Database]]
* [[Apache Cassandra]]
* [[Couchbase Server]]
* [[Cloudant]]
* [[Document-oriented database]]
* [[Lotus Notes]]
* [[MongoDB]]
* [[Redis]]
* [[Mnesia]]
* [[OrientDB]]
* [[Riak]]
* [[XML database]]
 
==References==
{{Reflist|3}}
 
==Bibliography==
Line 194 ⟶ 174:
* {{citation | first1 = Mick | last1 = Thompson | date = August 2, 2011 | title = Getting Started with GEO, CouchDB, and Node.js | edition = 1st | publisher = [[O'Reilly Media]] | pages = 64 | isbn = 1-4493-0752-3 | url = http://oreilly.com/catalog/9781449307523}}
{{Refend}}
 
== See also ==
{{Portal|Free software}}
<!--{{too many see alsos|date=April 2015}}
<!--* [[Apache Accumulo|Accumulo]]
* [[Apache Cassandra]]
* [[BigCouch]]
<!--* [[Cloudant]]
* [[Couchbase Server]]-->
* [[Document-oriented database]]
* [[LYCE (software bundle)]]
<!--* [[Lotus Notes]]
* [[MongoDB]]-->
* [[Mnesia]]
<!--* [[Redis]]-->
* [[Oracle NoSQL Database]]
* [[OrientDB]]
<!--* [[Riak]]-->
* [[XML database]]
 
==External links==
* {{Official website}}
* [http://books.couchdb.org/relax/ CouchDB: The Definitive Guide]
* [http://wiki.apache.org/couchdb/Complete_HTTP_API_Reference Complete HTTP API Reference]
* [https://github.com/1999/couchdb-php Simple PHP5 library to communicate with CouchDB]
* [http://code.google.com/p/async-couchdb-client/ Asynchronous CouchDB client for Java]
* [https://github.com/KimStebel/sprouch Asynchronous CouchDB client for Scala]
* {{cite web|last=Lehnardt|first=Jan|title=Couch DB at 10,000 feet|url=http://video.google.com/videoplay?docid=-3714560380544574985&hl=en#|work=Erlang eXchange 2008|accessdate=15 April 2012|year=2008}}
* {{cite web|last=Lenhardt|first=Jan|title=CouchDB for Erlang Developers|url=http://www.erlang-factory.com/conference/London2009/speakers/janlehnardt|work=Erlang Factory London 2009|accessdate=15 April 2012|year=2009}}
* {{cite web|last=Katz|first=Damien|title=CouchDB and Me|url=http://www.infoq.com/presentations/katz-couchdb-and-me|work=RubyFringe|publisher=InfoQ|accessdate=15 April 2012|date=January 2009}}
 
{{Apache}}
 
[[Category:Apache Software Foundation]]
[[Category:Cross-platform software]]
[[Category:Database-related software for Linux]]
[[Category:Distributed computing architecture]]
[[Category:Document-oriented databases]]
[[Category:Erlang (programming language)]]
[[Category:Free database management systems]]
[[Category:Document-orientedFree databasesWeb server software]]
[[Category:Distributed computing architecture]]
[[Category:Structured storage]]
[[Category:NoSQL]]
[[Category:Structured storage]]
[[Category:Unix network-related software]]
[[Category:Apache Software Foundation]]
[[Category:Free web server software]]
[[Category:Cross-platform software]]
[[Category:Database-related software for Linux]]