This articlereads like apress release or anews article and may be largely based onroutine coverage. Please helpimprove it by addingindependentsecondary sources.(November 2023) (Learn how and when to remove this message) |
| Apache CouchDB | |
|---|---|
CouchDB's Fauxton Administration Interface, User database | |
| Original authors | Damien Katz, Jan Lehnardt, Naomi Slater, Christopher Lenz, J. Chris Anderson, Paul Davis, Adam Kocoloski, Jason Davies, Benoît Chesneau, Filipe Manana, Robert Newson |
| Developer | Apache Software Foundation |
| Initial release | 2005; 21 years ago (2005) |
| Stable release | |
| Written in | Erlang,JavaScript,C,C++ |
| Operating system | Cross-platform |
| Type | Document-oriented database |
| License | Apache License 2.0 |
| Website | couchdb |
| Repository | |
Apache CouchDB is anopen-sourcedocument-orientedNoSQL database, implemented inErlang.
CouchDB uses multiple formats and protocols to store, transfer, and process its data. It usesJSON to store data,JavaScript as its query language usingMapReduce, andHTTP for anAPI.[2]
CouchDB was first released in 2005 and later became anApache Software Foundation project in 2008.
Unlike arelational database, a CouchDB database 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.
CouchDB implements a form ofmultiversion concurrency control (MVCC) so it does not 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.[3]
Other features include document-levelACID semantics witheventual consistency, (incremental) MapReduce, and (incremental) replication. One of CouchDB's distinguishing features ismulti-master replication, which allows it to scale across machines to build high-performance systems. A built-in Web application called Fauxton (formerly Futon) helps with administration.
Couch is an acronym forcluster of unreliable commodity hardware.[4] The CouchDB project was created in April 2005 by Damien Katz, a formerLotus Notes developer atIBM. He self-funded the project for almost two years and released it as an open-source project under theGNU General Public License.
In February 2008, it became an Apache Incubator project and was offered under theApache License instead.[5] A few months after, it graduated to a top-level project.[6] This led to the first stable version being released in July 2010.[7]
In early 2012, Katz left the project to focus onCouchbase Server.[8]
Since Katz's departure, the Apache CouchDB project has continued, releasing 1.2 in April 2012 and 1.3 in April 2013. In July 2013, the CouchDB community merged the codebase forBigCouch,Cloudant's clustered version of CouchDB, into the Apache project.[9] The BigCouch clustering framework is included in the current release of Apache CouchDB.[10]
Native clustering is supported at version 2.0.0. And the new Mango Query Server provides a simple JSON-based way to perform CouchDB queries without JavaScript or MapReduce. Also in version 2.0.0 was the introduction of Fauxton, the new built-in web interface, to replace Futon, the old built-in web interface.[11]
CouchDB also offers a built-in administration interface accessible via Web called Fauxton.[13]
Replication and synchronization capabilities of CouchDB make it ideal for using it in mobile devices, where network connection is not guaranteed, and 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.[14]
Users of CouchDB include:
CouchDB manages a collection ofJSON documents. The documents are organised via views. Views are defined withaggregate functions and filters are computed in parallel, much likeMapReduce.
Views are generally stored in the database and their indexes are updated continuously. CouchDB supports a view system using external socket servers and a JSON-based protocol.[27] As a consequence, view servers have been developed in a variety of languages (JavaScript is the default, but there are also PHP, Ruby, Python and Erlang).
Applications interact with CouchDB via HTTP. The following demonstrates a few examples usingcURL, a command-line utility. These examples assume that CouchDB is running onlocalhost (127.0.0.1) on port 5984.
| Action | Request | Response |
|---|---|---|
| Accessing server information | curlhttp://127.0.0.1:5984/ | {"couchdb":"Welcome","version":"1.1.0"} |
| Creating a database namedwiki | curl-XPUThttp://127.0.0.1:5984/wiki | {"ok":true} |
| Attempting to create a second database namedwiki | curl-XPUThttp://127.0.0.1:5984/wiki | {"error":"file_exists","reason":"The database could not be created, the file already exists."} |
| Retrieve information about thewiki database | curlhttp://127.0.0.1:5984/wiki | {"db_name":"wiki","doc_count":0,"doc_del_count":0,"update_seq":0,"purge_seq":0,"compact_running":false,"disk_size":79,"instance_start_time":"1272453873691070","disk_format_version":5} |
| Delete the databasewiki | curl-XDELETEhttp://127.0.0.1:5984/wiki | {"ok":true} |
| Create a document, asking CouchDB to supply a document id | curl-XPOST-H"Content-Type: application/json"--data\'{ "text" : "Wikipedia on CouchDB", "rating": 5 }'\http://127.0.0.1:5984/wiki | {"ok":true,"id":"123BAC","rev":"946B7D1C"} |
| get a list of databases | curlhttp://127.0.0.1:5984/_all_dbs | ["_replicator","_users","wiki"] |
CouchDB includes a number of other open source projects as part of its default package.
| Component | Description | License |
|---|---|---|
| Erlang | Erlang is a general-purposeconcurrentprogramming language andruntime system. The sequential subset of Erlang is afunctional language withstrict evaluation,single assignment, anddynamic typing | Apache 2.0 (Release 18.0 and later) Erlang Public License (Earlier releases) |
| ICU | International Components for Unicode (ICU) is anopen-source project of matureC/C++ andJava libraries forUnicode support, softwareinternationalization and software globalization | Unicode License |
| jQuery | jQuery is a lightweightcross-browserJavaScript library that emphasizes interaction betweenJavaScript andHTML | MIT License |
| OpenSSL | OpenSSL is anopen-source implementation of theSSL and TLS protocols. The corelibrary (written in theC programming language) implements the basiccryptographic functions and provides various utility functions | Apache 1.0 and thefour-clause BSD License |
| SpiderMonkey | SpiderMonkey is a performantJavaScript engine maintained by theMozilla Foundation. It contains aninterpreter, aJIT compiler and agarbage collector | MPL 2.0 |