[Couchdb Wiki] Update of "Document_revisions" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Document_revisions" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Document_revisions?action=diff=6=7 Comment: We've already warned about this in many other places already. - <> - == Overview == - - CouchDB does not overwrite updated documents in place, instead it creates a new document at the end of the database file, with the same `_id` but a new `_rev` identifier. This type of storage system is space-wasteful so regular [[Compaction]] is needed to reclaim disk space. Note that the older revisions are not available to [[Views]]. - - Document revisions are used for optimistic concurrency control. If you try to update a document using an old revision the update will be in conflict. These conflicts should be resolved by your client, usually by requesting the newest version of the document, modifying and trying the update again. - - @@ How does this relate to replication conflicts? - - === Revision History === - - '''You cannot rely on document revisions for any other purpose than concurrency control.''' - - Due to compaction, revisions may disappear at any time. You cannot use them for a client revision system. - - [[Replication]] has also an impact on revisions, i.e. '''Replication only replicates the last version of a document''', so it will be impossible to access, on the destination database, previous versions of a document that was stored on the source database. - - If you wish to implement revisions in your client system, a number of patterns have been suggested: - - * Using attachments to store old revisions. - * Using multiple documents to store old revisions. - - @@ Please add to this list and flesh out the solutions as you see fit. -
[Couchdb Wiki] Update of "Document_Update_Handlers" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Document_Update_Handlers" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Document_Update_Handlers?action=diff=28=29 Comment: Official docs on this are much better. - <> - ## page was renamed from Document Update Handlers - ## page was renamed from How_to_intercept_document_updates_and_perform_additional_server-side_processing - = Document Update Handlers = - - See also the [[http://docs.couchdb.org/en/latest/ddocs.html#update-functions|official documentation]] for this topic. - - < > - - == Basics == - Update handlers are functions that clients can request to invoke server-side logic that will create or update a document. This feature allows a range of use cases such as providing a server-side last modified timestamp, updating individual fields in a document without first getting the latest revision, etc. - - When the request to an update handler includes a document ID in the URL, the server will provide the function with the most recent version of that document. You can provide any other values needed by the update handler function via the POST/PUT entity body or query string parameters of the request. - - This feature was first implemented in CouchDB version 0.10. - - == Creating an Update Handler == - You can specify any number of update handler functions in a design document, under the "updates" attribute. - - For example: - - {{{#!highlight javascript - { - updates: { - - "hello" : "function(doc, req) { - if (!doc) { - if (req.id) { - return [{ - _id : req.id - }, 'New World'] - } - return [null, 'Empty World']; - } - doc.world = 'hello'; - doc.edited_by = req.userCtx; - return [doc, 'hello doc']; - }", - - "in-place" : "function(doc, req) { - var field = req.form.field; - var value = req.form.value; - var message = 'set '+field+' to '+value; - doc[field] = value; - return [doc, message]; - }", - - "in-place-query" : "function(doc, req) { - var field = req.query.field; - var value = req.query.value; - var message = 'set '+field+' to '+value; - doc[field] = value; - return [doc, message]; - }", - - "bump-counter" : "function(doc, req) { - if (!doc.counter) doc.counter = 0; - doc.counter += 1; - var message = 'bumped it!'; - return [doc, message]; - }", - - "error" : "function(doc, req) { - superFail.badCrash; - }", - - "xml" : "function(doc, req) { - var xml = new XML(''); - xml.title = doc.title; - var posted_xml = new XML(req.body); - doc.via_xml = posted_xml.foo.toString(); - var resp = { - 'headers' : { - 'Content-Type' : 'application/xml' - }, - 'body' : xml - }; - -return [doc, resp]; - }" - } - } - }}} - The handler function takes the most recent version of the document from the database and the http request environment as parameters. It returns a two-element array: the first element is the (updated or new) document, which is committed to the database. If the first element is null no document will be committed to the database. If you are updating an existing, it should already have an `_id` set, and if you are creating a new document, make sure to set its `_id` to something, either generated based on the input or the `req.uuid` provided. The second element is the response that will be sent back to the caller. - - If you want the client to get the changed document (without an additional request) you can return it as the second element of the return array, but you need to turn it into a string first. - - {{{#!highlight javascript - { - updates: { - "in-place": "function (doc, req) { - doc.field = req.form.field.new_value; - - return [doc, toJSON(doc)]; - }" - } - } - }}} - '''Note''' The document returned in this manner will have the "old" _rev, see the response section for how retrieve the new/current _rev. - - == Request == - The request parameter will look something like this for a update function designed to create a new document: - - {{{#!highlight javascript - { - "info": { - "db_name": "loot", - /* and many more */ - "committed_update_seq": 27 - }, - "id": null, - "uuid": "7f8a0e3833bcc7161cfab80275221dc1", - "method": "POST", - "path": ["loot", "_design", "haul", "_update", "new"], - "query": {}, - "headers": {"Accept": "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" /* and many more */}, - "body": "name=Jeff", - "peer": "127.0.0.1", - "form": {"name": "Jeff"}, - "cookie": {}, - "userCtx": {"db": "loot", "name": null, "roles": []} - } - }}} - Since no ID was passed, the
[Couchdb Wiki] Update of "Document_Update_Validation" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Document_Update_Validation" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Document_Update_Validation?action=diff=10=11 Comment: We have good official docs on this now. - <> - = Document Update Validation = - - See also the [[http://docs.couchdb.org/en/latest/ddocs.html#validate-document-update-functions|official documentation]] for this topic. - - < > - - A design document may define a member function called "validate_doc_update". Requests to create or update a document are validated against every "validate_doc_update" function defined in the database. The validation functions are executed in an unspecified order. A design document can contain only one validation function. Errors are thrown as javascript objects. - - Example of a design document that validates the presence of an "address" field and returns : - - {{{#!highlight javascript - { -"_id": "_design/myview", -"validate_doc_update": "function(newDoc, oldDoc, userCtx, secObj) { - if (newDoc.address === undefined) { - throw({forbidden: 'Document must have an address.'}); - }" - } - }}} - The result of a document update without the address field will look like this: - - {{{ - HTTP/1.1 403 Forbidden - WWW-Authenticate: Basic realm="administrator" - Server: CouchDB/0.9.0 (Erlang OTP/R12B) - Date: Tue, 21 Apr 2009 00:02:32 GMT - Content-Type: text/plain;charset=utf-8 - Content-Length: 57 - Cache-Control: must-revalidate - - {"error":"forbidden","reason":"Document must have an address."} - }}} - The "validate_doc_update" function accepts three arguments: - - 1. newDoc - The document to be created or used for update. - 1. oldDoc - The current document if document id was specified in the HTTP request - 1. userCtx - User context object, which contains three properties: - a. db - String name of database - a. name - String user name - a. roles - Array of roles to which user belongs. Currently only admin role is supported. - 1. secObj - The security object of the database (introduced in CouchDB-0.11.1). - - == Error Formats == - - Thrown errors must be javascript objects with a key of either "forbidden" or "unauthorized," and a value with the error message: - - {{{ - throw({forbidden: 'Error message here.'}); - }}} - or - {{{ - throw({unauthorized: 'Error message here.'}); - }}} - - == Toolbox == - Some of these functions are found in http://guide.couchdb.org/draft/validation.html . Use them inside your validate_doc_update functions. - - {{{ - function required(field, message /* optional */) { - message = message || "Document must have a " + field; - if (!newDoc[field]) throw({forbidden : message}); - } - - function unchanged(field) { - if (oldDoc && toJSON(oldDoc[field]) != toJSON(newDoc[field])) - throw({forbidden : "Field can't be changed: " + field}); - } - - function user_is(role) { - return userCtx.roles.indexOf(role) >= 0; - } - }}} - Here is a validation function I use to manage update Authorization using the roles as an ACL. A user may modify documents for which the accounts listed in his "roles" ACL are a prefix of the account specified. - - {{{ - function user_match(account,message /* optional */) { - for (var i in userCtx.roles) { - var prefix = userCtx.roles[i]; - /* prefix-matching: "roles" will contain strings like "account:0003546" -- or define your own matching rules */ - if( ("account:"+account).substring(0,prefix.length) === prefix ) return; - } - throw({forbidden : message||"No access to this account"}); - } - - /* Usage */ - if(oldDoc) { - if(newDoc._deleted) { - user_match(newDoc.account,"You are not authorized to delete this document"); - } else { - unchanged("account"); - user_match(newDoc.account,"You are not authorized to modify this document"); - } - } else { - user_match(newDoc.account,"You are not authorized to create this document"); - } - }}} -
[Couchdb Wiki] Update of "Durability_Matrix" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Durability_Matrix" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Durability_Matrix?action=diff=6=7 Comment: This is super outdated... - = DRAFT = - Still working on this... - - = Introduction = - - The durability of data is a leading concern with any database and yet few databases are ever explicit about their durability properties. This page attempts to precisely describe the durability that CouchDB delivers under different configurations (both software and hardware). - - The only operations with durability concerns are those where a client writes documents or attachments to couchdb. Other operations, like updating view indexes, or compaction, are safely and seamlessly resumable if interrupted by power failure, etc. - - In all cases, durability is determined by calls to the operating system that flush data to persistent storage, typically a hard drive or a solid-state device. It is the precise moments that these calls are made, and their exact behavior, that will drive the rest of the page. - - = How file:sync() works = - - All data flushing is performed by file:sync(IoDevice). This function maps to fsync(fd) on most platforms, with the notable exception of OS/X where fcntl(F_FULLFSYNC) is called instead. - - A call to fsync(fd) should ensure, on completion, that all pending writes have reached the disk. On many platforms, and Linux in particular, this promise is not upheld in the presence of write-caching disk controllers. On affected configurations, a call to fsync(fd) will complete as soon as all pending writes have reached the cache of the disk controller itself. If your controller has battery-backing, you might decide this is sufficiently durable. On OS/X, the fcntl(F_FULLFSYNC) really gets all pending writes to disk even in the presence of a write-caching disk controller. This is the reason that CouchDB is "slower" on OS/X. - - = How CouchDB uses fsync() = - - CouchDB uses a strictly append-only pattern when writing documents and attachments to the database file. In order to ensure database integrity, a footer is also included which contains, among other things, the location of the current root of the various B+Tree's that CouchDB uses internally. The order of writes is as follows; - - 1. file:sync() - 1. append the header - 1. file:sync() - - The appending of the header is bookended by sync() calls in order to ensure correct ordering of writes even through failure scenarios. Because of the strong checksum on the header, no failing write can corrupt the database. At worst, the database reflects the previous state. - - = Durability Matrix = - - Since calling file:sync() twice for every document added is prohibitively expensive, CouchDB almost always does some degree of batching. Under normal circumstances, your document is appended to the file, but not sync'ed, along with any other writes from other clients. Within one second, all of those writes are sync'ed and the header is updated. You can increase write performance, and the cost of delaying durability, if you use the batch=ok parameter on your write request. Your write will eventually be durable, but no time commitment has been made (you will receive a "202 Accepted" instead of the usual "201 Created" to reflect this weaker promise). To ensure your write is durable before you get a response, you can add a custom HTTP header (X-Couch-Full-Commit: true) to your write request. Your data is sync'ed and the header of the database is written and sync'ed before your response is returned. - - Below is a table that summarizes all the options currently available that affect durability; - - - TODO ! - - - - -
[Couchdb Wiki] Update of "DémarrerAvecAmazonEc2" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "DémarrerAvecAmazonEc2" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/D%C3%A9marrerAvecAmazonEc2?action=diff=4=5 Comment: super outdated - #language fr - Démarrez avec CouchDB et Amazon Elastic Compute Cloud. - == Debut == - * Lancez AMI ''ami-b832d7d1'', et obtenez un DNS Public. - * Authorisez le port TCP 5984. - * Dans le naviagateur, ouvrez http://PublicDNS.compute-1.amazonaws.com:5984/. - - == Description détaillé == - Cette version d'AMI est basée sur Debian 3.1 (Etch) avec une installation Elastic, so you might consider some kind of persistence to Amazon S3 or other supported platforms, like Nirvanix etc., thus preserving the data that is stored in CouchDB. - - CouchDB has been built from source (version 0.7.2, revision 645), and configured to run as a service. - - == AMI Support == - All the necessary information has been submitted for inclusion into repository of Amazon Public AMIs, and is listed as [[http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1192=101|ElasticDB - (Elasticdrive + CouchDB)]]. We created support thread at Amazon forums, specifically [[http://developer.amazonwebservices.com/connect/thread.jspa?threadID=19405=0|Amazon SimpleDB (Beta)]] and provide limited support there, when time allows and scope is limited to EC2/SimpleDB-related issues. -
[Couchdb Wiki] Update of "EditTheWiki" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "EditTheWiki" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/EditTheWiki?action=diff=15=16 - ## page was renamed from EditTheWiki-Old - ## page was renamed from EditTheWiki - ||<#efefef>We have a [[https://cwiki.apache.org/confluence/display/COUCHDB/Apache+CouchDB+Wiki|new wiki]]. The migration is not 100% complete. You can help out by moving pages across. This wiki will exist for as long as there are pages left.|| - - ||<#efefef>The official documentation has moved to [[http://docs.couchdb.org]] — The transition is not 100% complete, but [[http://docs.couchdb.org]] should be seen as having the latest info. In some cases, the wiki still has some more or older info on certain topics inside CouchDB.|| - ||<#efefef>~-You need to be added to the ContributorsGroup to edit the wiki. But don't worry! Just email any [[http://wiki.apache.org/couchdb/Mailing%20lists|Mailing List]] or grab us on [[irc://irc.freenode.net/couchdb|IRC]] and let us know your user name.-~|| -
[Couchdb Wiki] Update of "ErrorMessages" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "ErrorMessages" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/ErrorMessages?action=diff=12=13 - #redirect Error_messages - Explanation and solution of error messages you may experience while building or running CouchDB. - == Missing icu-config == - - === Problem === - - {{{ - *** The icu-config script could not be found. Make sure it is - *** in your path, and that taglib is properly installed. - *** Or see http://ibm.com/software/globalization/icu/ - }}} - - === Solution === - - Install ICU and use `locate` to find the `icu-config` command: - - {{{ - locate icu-config - }}} - - Take the directory from the output of this command and add it to your `PATH`: - - {{{ - export PATH="$PATH:/usr/local/bin" - }}} - - - == Incorrect LD_LIBRARY_PATH == - - === Problem === - - {{{ - $ couchdb - Apache CouchDB 0.8.0-incubating (LogLevel=info) - Apache CouchDB is starting. - - {"init terminating in do_boot",{error,{open_error,-10}}} - - Crash dump was written to: erl_crash.dump - init terminating in do_boot () - }}} - - or - - {{{ - $ couchdb - Apache CouchDB 0.8.1-incubating (LogLevel=info) - Apache CouchDB is starting. - - {"init terminating in do_boot","libjs.so: cannot open shared object file: No such file or directory"} - - Crash dump was written to: erl_crash.dump - init terminating in do_boot (libjs.so: cannot open shared object file: No such file or directory) - }}} - - === Solution === - - You must correctly set your `LD_LIBRARY_PATH` environment variable so that it picks up your installed libraries. On Mac OS X, the equivalent variable is `DYLD_LIBRARY_PATH`. - - Example running as normal user: - - {{{ - LD_LIBRARY_PATH=/usr/local/lib:/usr/local/spidermonkey/lib couchdb - }}} - - Example running as `couchdb` user: - - {{{ - echo LD_LIBRARY_PATH=/usr/local/lib:/usr/local/spidermonkey/lib couchdb | sudo -u couchdb sh - }}} - - Similar instructions are on the InstallingSpiderMonkey page. - - - == Binary Architecture Mismatch == - - On Mac OS X, libraries and executables can be ''fat binaries'' that support multiple processor architectures (PPC and x86, 32 and 64 bit). But that also means you will run into problems when trying to load a library into an application if that library doesn't support the architecture used by the application process. - - === Problem === - - {{{ - $ couchdb - Apache CouchDB 0.8.0-incubating (LogLevel=info) - Apache CouchDB is starting. - - {"init terminating in do_boot",{error,{open_error,-12}}} - - Crash dump was written to: erl_crash.dump - init terminating in do_boot () - }}} - - === Solution === - - You've probably built Erlang with the 64 bit option enabled. The problem is that ICU, which CouchDB attempts to load at startup time, has not been compiled with 64 bit support, so it can't be loaded into the 64bit Erlang process. - - For now you'll have to recompile Erlang, and resist the temptation to build a 64 bit binary (just omit the `--enable-darwin-64bit` option). The `--enable-darwin-universal` option works okay, but note that currently there's no universal build of ICU available. - - == Unavailable Port == - - === Problem === - - {{{ - $ couchdb - Apache CouchDB 0.8.0-incubating (LogLevel=info) - Apache CouchDB is starting. - - ... - [error] [<0.46.0>] {error_report,<0.21.0>, - ... -{couch_httpd,start_link, -["127.0.0.1","5984","/tmp/couchdb-a/share/couchdb/www"]}}, -{restart_type,permanent}, -{shutdown,1000}, -{child_type,supervisor}]}]}} - ... - }}} - - === Solution === - - Edit your `/etc/couchdb/couch.ini` file and change the `Port` setting to an available port. - - == Missing OpenSSL == - - === Problem === - - {{{ - $ bin/couchdb - Apache CouchDB 0.8.0-incubating (LogLevel=info) - Apache CouchDB is starting. - - {"init terminating in do_boot",{undef,[{crypto,start,[]},{erl_eval,do_apply,5},{init,start_it,1},{init,start_em,1}]}} - - Crash dump was written to: erl_crash.dump - init terminating in do_boot () - }}} - - === Solution === - - You need to install the OpenSSL libraries and recompile Erlang with SSL enabled. - - == Incorrect Permissions == - - === Problem === - - {{{ - $ bin/couchdb - Apache CouchDB 0.9.0a691361-incubating (LogLevel=info) is starting. - {"init terminating in do_boot",{{badmatch,{error,shutdown}},[{couch_server_sup,start_server,1},{erl_eval,do_apply,5},{erl_eval,exprs,5},{init,start_it,1},{init,start_em,1}]}} - - Crash dump was written to: erl_crash.dump - init terminating in do_boot () - }}} - - === Solution === - - You need to make sure that the user running couchdb has permissions to write to /usr/local/var/lib/couchdb and /usr/local/var/log/couchdb. -
[Couchdb Wiki] Update of "Error_messages" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Error_messages" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Error_messages?action=diff=32=33 - <> - = Error Messages = - - This content has been migrated to the [[http://docs.couchdb.org/en/latest/install/troubleshooting.html|official CouchDB documentation]]. -
[Couchdb Wiki] Update of "Example usages of DbUpdateNotification" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Example usages of DbUpdateNotification" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Example%20usages%20of%20DbUpdateNotification?action=diff=12=13 Comment: This doesn't exist anymore - and 2.x has /_db_updates instead. - ## page was renamed from Regenerating_views_on_update - = Example usages of DbUpdateNotification = - == Update views on document save == - <> - - CouchDB defaults to regenerating views the first time they are accessed. This behavior is preferable in most cases as it optimizes the resource utilization on the database server. - On the other hand, in some situations the benefit of always having fast and updated views far outweigh the cost of regenerating them every time the database server receives updates. This can be achieved by supplying an updater script that calls the views when needed. - - == Example using ruby == - - === couch.ini === - (0.8) Add the following line to the couch.ini file - {{{ - DbUpdateNotificationProcess=/PATH/TO/view_updater.rb - }}} - - (0.9+) Add the following section to the local.ini file: - {{{ - [update_notification] - view_updater=/PATH/TO/view_updater.rb - }}} - - === view_updater.rb === - The following script updates the views for each tenth update made to the database or at most once every second when a lot of saves are performed - - {{{#!highlight ruby - #!/usr/bin/ruby - - ### - # CONF# - ### - - # The smallest amount of changed documents before the views are updated - MIN_NUM_OF_CHANGED_DOCS = 10 - - # URL to the DB on the CouchDB server - URL = "http://localhost:5984; - - # Set the minimum pause between calls to the database - PAUSE = 1 # seconds - - # One entry for each design document - # in each database - VIEWS = {"my_db" => {"design_doc" => "view_name"}} - - ### - # RUNTIME # - ### - - run = true - number_of_changed_docs = {} - - threads = [] - - # Updates the views - threads << Thread.new do - - while run do - - number_of_changed_docs.each_pair do |db_name, number_of_docs| - if number_of_docs >= MIN_NUM_OF_CHANGED_DOCS - - # Reset the value - number_of_changed_docs[db_name] = 0 - - # If there are views in the database, get them - if VIEWS[db_name] - VIEWS[db_name].each do |design, view| - `curl #{URL}/#{db_name}/_design/#{design}/_view/#{view}?limit=0` - end - end - - end - end - - # Pause before starting over again - sleep PAUSE - - end - - end - - # Receives the update notification from CouchDB - threads << Thread.new do - - while run do - - STDERR << "Waiting for input\n" - update_call = gets - - # When CouchDB exits the script gets called with - # a never ending series of nil - if update_call == nil - run = false - else - - # Get the database name out of the call data - # The data looks something like this: - # {"type":"updated","db":"DB_NAME"}\n - update_call =~ /\"db\":\"(\w+)\"/ - database_name = $1 - - # Set to 0 if it hasn't been initialized before - number_of_changed_docs[$1] ||= 0 - - # Add one pending changed document to the list of documents - # in the DB - number_of_changed_docs[$1] += 1 - - end - - end - - end - - # Good bye - threads.each {|thr| thr.join} - - }}} - - The view_updater.rb itself has to be made executable by CouchDB (chmod 0700?). - - == Example using Python == - - {{{#!highlight python - - #!/usr/bin/env python - # -*- coding: utf-8 -*- - - """Updater script to regenerate couchdb views on update. - """ - - import logging - logging.basicConfig(level=logging.INFO) - - import os - import re - import signal - import sys - import time - import urllib2 - - from threading import Thread - - flags = { - 'is_running': True - } - - changed_docs = {} - - class ViewUpdater(object): - """Updates the views. - """ - - # The smallest amount of changed documents before the views are updated - MIN_NUM_OF_CHANGED_DOCS = 50 - - # Set the minimum pause between calls to the database - PAUSE = 5 # seconds - - # URL to the DB on the CouchDB server - URL = "http://localhost:5984; - - # One entry for each design document - # in each database - VIEWS = { - 'my_db': { - 'design_doc': [ - 'view_name', - # ... - ] - } - } - - def start(self): - Thread(target=self._run).start() - - - def _run(self): - """Loop, checking for enough ``changed_docs`` to trigger a - request to couchdb to re-index. -
[Couchdb Wiki] Update of "ExternalProcesses" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "ExternalProcesses" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/ExternalProcesses?action=diff=21=22 Comment: Yeah, don't do this. Please. At all. - <> - = External Processes = - - '''NOTE''': A much better way to do this is via the new HTTP Proxying feature. See the [[http://docs.couchdb.org/en/latest/configuring.html#http-proxying|official documentation]] for that topic. - - < > - - CouchDB now allows for the ability to develop custom behaviors via processes that communicate over ''stdin'' and ''stdout''. Requests to CouchDB that are captured by the external process handler are passed via JSON object to the external process over ''stdin'' and reads a JSON object from ''stdout''. Without further ado... - - == JSON Requests == - Requests capture information about the incoming HTTP request and transform it into a JSON object. I've formatted the object here, though in real life this object would contain no new lines and all embedded white space would be normalized to a single ' ' (space) character. - - An example object: - - {{{#!highlight javascript - { - 'body': 'undefined', - 'cookie': { - '__utma': '96992031.3087658685658095000.1224404084.1226129950.1226169567.5', - '__utmz': '96992031.1224404084.1.1.utmcsr' - }, - 'form': {}, - 'info': { - 'compact_running': False, - 'db_name': 'couchbox', - 'disk_size': 50559251, - 'doc_count': 9706, - 'doc_del_count': 0, - 'purge_seq': 0, - 'update_seq': 9706}, - 'path': [], - 'query': {}, - 'method': 'GET' - } - }}} - In order: - - * ''body'' - Raw post body - * ''cookie'' - Cookie information passed on from mochiweb - * ''form'' - If the request's Content-Type is "application/x-www-form-urlencoded", a decoded version of the body - * ''info'' - Same structure as returned by http://127.0.0.1:5984/db_name/ - * ''path'' - Any extra path information after routing to the external process - * ''query'' - Decoded version of the query string parameters. - * ''method'' - HTTP request verb - * ''userCtx'' - Information about the User - - Note: Before CouchDB 0.11 `method` was `verb`. - - == JSON Response == - The response object has five possible elements - - * ''code'' - HTTP response code [Default is 200]. Note that this must be a number and cannot be a string (no ""). - * ''headers'' - An object with key-value pairs that specify HTTP headers to send to the client. - * ''json'' - An arbitrary JSON object to send the client. Automatically sets the Content-Type header to "application/json" - * ''body'' - An arbitrary CLOB to be sent to the client. Content-Type header defaults to "text/html" - * ''base64'' - Arbitrary binary data for the response body, base64-encoded - - While nothing breaks if you specify both a ''json'' and ''body'' member, it is undefined which response will be used. If you specify a Content-Type header in the ''headers'' member, it will override the default. - - == Common Pitfalls == - * When responding to queries always remember to turn off buffering for ''stdout'' or issue a ''flush()'' call on the file handle. - * All interaction is in the form of single lines. Each response should include *exactly* one new line that terminates the JSON object. - * When using base64 encoders, be sure to strip any CRLF from the result - most encoders will add CRLF after 76 characters and at the end. - * CouchDB 0.10 looks for a case-sensitive match of the Content-Type header -- a user-defined header must specify "Content-Type", not "content-type" or "CoNtEnT-type". This is fixed in future releases. - * When developing handlers you need to restart CouchDB after each change as it doesn't see the changes until you restart the server. - * '''Notes for OSX users:''' - If you are using launchctl to load and unload your CouchDB instance, it by default starts the couchdb instance with user couchdb. External handlers won't run if they are not executable by this user. Calls to them will fail with a 'OS Process timeout' error stack trace from Erlang. If you start couchdb with sudo couchdb things will work fine. Here is an article in more detail http://www.vertigrated.com/blog/2010/04/couchdb-launchctl-external-httpd-handlers-madness/ - - == Configuration == - Adding external processes is as easy as pie. Simply place key=command pairs in the ''[external]'' section of your ''local.ini'' and then map those handlers in the ''[httpd_db_handlers]'' section, like: - - {{{ - ;Including [log] and [update_notification] for context - - [log] - level = info - - [external] - test = python /usr/local/src/couchdb/test.py - - [httpd_db_handlers] - _test = {couch_httpd_external, handle_external_req, <<"test">>} - - [update_notification] - ;unique notifier
[Couchdb Wiki] Update of "FoireAuxQuestions" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "FoireAuxQuestions" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/FoireAuxQuestions?action=diff=4=5 Comment: poof - #language fr - Une FAQ pour toutes les questions autour de CouchDB. - - Si vous avez une question dont la réponse n'existe pas dans cette FAQ, merci de l'ajouter à la fin. Revenez au bout de quelques jours, quelqu'un y aura peut-être répondu. - - == Qu'est-ce que CouchDB? == - - CouchDB est une base de données orientée document non relationnelle (NRDBMS). La page d'[[http://incubator.apache.org/couchdb/docs/intro.html|Introduction]] possède plus d'information sur le système de CouchDB. - - == Quel est le statut de CouchDB ? == - - version Alpha. Il manque encore d'importantes fonctionnalités, mais est suffisamment utilisable pour être testée. - - == Qu'est-ce que Couch signifie ? == - - C'est un acronyme pour Cluster Of Unreliable Commodity Hardware. Il résume les objectifs long terme de CouchDB qui sont d'être facilement extensible et fortement disponible sur des machines sensibles aux pannes. La nature distribuée et la structure à plat des données de la base permettra le partionnement horizontal pour étendre le stockage (avec du map/reduce pour les requêtes) et du cluster pour la disponibilité et la résistance aux pannes. - - == En quel langage est écrit CouchDB ? == - - Erlang, un langage fonctionnel concurrent temps réel et distribué, qui possède des fonctionnalités de tolérance aux pannes. Les premières versions de CouchDB étaient en C mais furent remplacées par la plateforme Erlang OTP. Erlang montre depuis qu'il correspond parefaitement à ce type de projet. - - CouchDB utilise la bibliothèque Javascript Mozilla's Spidermonkey en C. - - == Quelles plateformes sont supportées ? == - - La plupart des systèmes POSIX, ce qui inclue GNU/Linux et OS X. - - Windows n'est pas officiellement supporté mais devrait fonctioner, si c'est le cas tenez-nous au courant. - - == Quelle est la license ? == - - [[http://www.apache.org/licenses/LICENSE-2.0.html|Apache 2.0]] - - == Quelle volume de données je peux stocker dans CouchDB ? == - - Avec un système réparti, virtuellement illimité. Pour une seule instance de base de donnée, la limite n'est pas encore connue. - - == Comment je fais des suites ? == - - Ou autrement dit, où est AUTO_INCREMENT ?! Avec la réplication les suites sont difficiles à réaliser. Les suites sont souvent utilisées pour créer des identifiants uniques pour chaque ligne de la base de données. CouchDB peut générer des ids uniques ou vous pouvez créer les votre, vous n'avez donc pas forcemment besoin de suites. Si vous utilisez une suite pour autre chose, vous devez trouver un moyen de l'intégrer dans CouchDB. - - == Comment j'utilise la réplication ? == - - {{{ - POST /_replicate?source=$source_basededonnée=$destination_basededonnée - }}} - - Où $source_basededonnée et $destination_basededonnée peuvent être les noms de bases locales ou des URIs correspondant à des bases de données distantes. Chacune des bases doit exister avant de lancer la réplication. - - == Quelle est la rapidité des vues ? == - - Il est difficile de vous donner des chiffres significatifs. D'un point de vue architecture, une vue sur une table est comme un index (multi-colonnes) d'une table dans une base de données relationnelle (RDBMS) sur lequel on lance une recherche rapide. C'est donc en théorie très rapide. - - Cependant, cette architecture a été conçue pour supporter un trafic important. Aucun blocage ne peut avoir lieu dans le module de stockage (MVCC & ...) autorisant ainsi un grand nombre de lectures et d'écritures sérialisées en parallèles. Avec la réplication vous pouvez même configurer plusieurs machines pour partitionner horizontalement ls données (dans le futur). (Voir [[http://jan.prima.de/~jan/plok/archives/72-Some-Context.html|le slide 13 de l'essai de Jan Lehnardt]] pour plus d'informations sur le module de stockage ou l'article complet.) - - == Pourquoi CouchDB n'utilise pas Mnesia? == - - Plusieurs raisons : - - * La première est la limitation de 2giga par fichier. - * La seconde est que cela requiert une validation et un cycle de réparation après un crash ou une panne de courant, donc même si la taille des fichiers était augmentée, le temps de réparation sur des gros fichiers est prohibitif. - * Le système de réplication de Mnesia replication fonctionne sur des clusters mais pas pour du distribué ou du deconnecté. La plupart des fonctionnalités ""cool" de Mnesia ne sont pas utiles pour CouchDB. - * Par ailleurs Mnesia n'est pas vraiment une base de donnée "scalable"(ndlr: trouver une traduction). C'est plus une base pour des données de configuration. les données qui s'y trouvent ne sont pas le centre de l'application mais nécessaires à son fonctionnement. Des chose comme les routeurs, les proxy
[Couchdb Wiki] Update of "Formatting_with_Show_and_List" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Formatting_with_Show_and_List" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Formatting_with_Show_and_List?action=diff=33=34 Comment: We already ahve the documentation for show/list that we want...the rest is semi-deprecated. - <> - = Formatting with Show and List = - - See also the official documentation for the - [[http://docs.couchdb.org/en/latest/ddocs.html#show-functions|show]] and - [[http://docs.couchdb.org/en/latest/ddocs.html#list-functions|list]] topics. - - < > - - Note that this is only available in CouchDB 0.9 or newer - - The basics of formatting documents using `show` and `list` functions. These functions convert documents and views, respectively, into non-JSON formats. The rows of each view are processed individually, which keeps long lists from becoming memory hogs. - - They are designed to be cacheable. CouchDB handles generating Etags for show and list responses. - - Show and list functions are side effect free and idempotent. They can not make additional HTTP requests against CouchDB. Their purpose is to render JSON documents in other formats. - - == Showing Documents == - . [[http://guide.couchdb.org/draft/show.html|CouchDB Guide section]] - - Show functions are stored in your design document, under the `shows` key. Here's an example set of show functions: - - {{{#!highlight javascript - { - "_id": "_design/examples", - "shows": { - "posts": "function(doc, req) { /*...*/ return responseObject;}", - "people": "function(doc, req) { /*...*/ }" - } - } - }}} - Assuming these functions were in a design document named "`examples`" in a database named "`db`", they could be queried like this: - - {{{ - GET /db/_design/examples/_show/posts/somedocid - - GET /db/_design/examples/_show/people/otherdocid - - GET /db/_design/examples/_show/people/otherdocid?format=xml=true - }}} - The `show` function is run with two arguments. The first is the document corresponding to the requested `docid`, and the second describes the HTTP request's query string, Accept headers, and other per-request information. The function returns an object describing its HTTP response. - - Example `show` function - - {{{#!highlight javascript - function(doc, req) { - return { - body: "Hello World" - } - } - }}} - If the show function is queried with document id that has no corresponding document in the database, `doc` is `null` and the submitted document shows up in `req.id`. This is useful for creating new documents with a name, like in a wiki. - - If the show function is queried without a document id at all, doc is `null` and `req.id` is `null`. This is useful for creating new documents where the user specifies the new document id in a user interface, like in a CMS. - - {{{#!highlight javascript - function(doc, req) { - if(doc) { - // regular doc display logic - } else { // document not found - if(req.id) { - // handle unused doc id - } else { - // handle unspecified doc id - } - } - } - }}} - The request and response objects are of the same format used by `_external` functions, as documented in ExternalProcesses. - - Since CouchDB 0.11.0 you can use the `send()` function as explained below in show functions as well. - - == Listing Views with CouchDB 0.10 and later == - . [[http://guide.couchdb.org/draft/transforming.html|CouchDB Guide section]] - - List functions are stored under the `lists` key of a design document. Here's an example design doc with list functions, in addition to views: - - {{{#!highlight javascript - { - "_id": "_design/examples", - "views" { - "posts-by-date": {"map": "function(doc){ /*...*/ }"}, - "posts-by-tag": {"map": "function(doc){ /*...*/ }"}, - "people-by-name": {"map": "function(doc) { /*...*/ }"} - }, - "lists": { - "index-posts": "function(head, req) { /*...*/ }", - "browse-people": "function(head, req) { /*...*/ }" - } - } - }}} - These lists are run by querying URLs like: - - {{{ - GET /db/_design/examples/_list/index-posts/posts-by-date?descending=true=10 - - GET /db/_design/examples/_list/index-posts/posts-by-tag?key="howto" - - GET /db/_design/examples/_list/browse-people/people-by-name?startkey=["a"]=10 - }}} - As above, we assume the database is named "db" and the design doc "examples". - - Couchdb 0.10 supports an alternate form of URL which allows you to use a list function and a view from different design documents. This is particularly useful when you want to use a different language for the list and for the view. These URLs are very similar to the above examples, but instead of the tail portion being the name of the view, the tail portion can consist of two parts - a design doc name and the name of the view in that second document.
[Couchdb Wiki] Update of "FullTextIndexWithView" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "FullTextIndexWithView" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/FullTextIndexWithView?action=diff=4=5 Comment: EEew. Use clouseau/dreyfus - #redirect Full_text_index_with_view - I wanted to throw this idea out there to see what people thought. - There has been a lot of discussion about integrating full text search into couch and possibly implementing full text search in Erlang. Would it be worth investigating the use of CouchDB's !MapReduce functionality to implement a full text indexer? I whipped together a short example using views. It implements a simple white space tokenizer in !JavaScript, emits each token with it's doc id and position, and reduces each token to a list of doc ids and positions. - - Here is the map function: - - {{{ - function(doc) - { - var tokenEmit = function(token) { - emit([token.value,token.field], [this._id,token.position]); - } - - var whiteSpaceAnalyzer = function(str, field) { - // Returns tokens split by white space - // token: { value: tokenString, position: [0,10] } - var len = str.length; - var tokenPositions = new Array(); - var startPosition = null; - - var isTokenChar = function(Char) { - if (Char === ' ' || Char === '\t' || Char === '\n') - return false; - return true; - } - - for(var i=0; i < len; i++) - { - if(startPosition == null) - { - if(isTokenChar(str[i])) - { - // start of word - startPosition = i; - if( i+1 == len ) - { - // end of string - tokenPositions[tokenPositions.length] = [startPosition, i+1]; - } - } - } - else - { - if(!isTokenChar(str[i])) - { - // end of word - tokenPositions[tokenPositions.length] = [startPosition, i]; - startPosition = null; // reset startPosition - continue; - } - - if( i+1 == len ) - { - // end of string - tokenPositions[tokenPositions.length] = [startPosition, i+1]; - } - } - } - - var tokenMap = function(tokenPosition) { - var token = this.str.substring(tokenPosition[0],tokenPosition[1]); - return { value: token, field:this.field, position: tokenPosition }; - } - - return tokenPositions.map(tokenMap,{str:str,field:field}); - } - - var tokens; - - for (field in doc) { - if (typeof(doc[field])=='string') { - tokens = whiteSpaceAnalyzer(doc[field], field); - tokens.map(tokenEmit, doc); - } - } - } - }}} - - Here is the reduce function: - - {{{ - function(keys,values,combine) - { - var result = new Array(); - var docHash = new Array(); - if(combine) - { - for(var v in values) - { - var docObject = values[v][0]; - var docId = docObject["doc"]; - var positions = docObject["pos"]; - if(docHash[docId] == null) - { - docHash[docId]=new Array(); - } - docHash[docId] = docHash[docId].concat(positions); - } - for(var i in docHash){ - result[result.length]={doc:i,pos:docHash[i]}; - } - } - else - { - for(var j in values) - { - var docId = values[j][0]; - var position = values[j][1]; - if(docHash[docId] == null) - { - docHash[docId]=new Array(); - } - docHash[docId] = docHash[docId].concat([position]); - } - for(var i in docHash){ - result[result.length]={doc:i,pos:docHash[i]}; - } - } - return result; - } - }}} - - The key emitted from the view is {{{["token","field"]}}}. This allows terms to be searched per field while also allowing the use of group_level=1 to combine the results of all fields. Combining results of multiple fields currently eliminates the use of positions. - - To reduce the amount of information passed during view generation the whiteSpaceAnalyzer function can be moved to the main.js file. - - Is this worth pursuing further? - ___ - - After pursuing this a little further, here's an expanded version of the above m/r functions, modified to support stemming (via porter), optional case-insensitivity, min-length for tokens, wider whitespace handling (still english-centric though). - -
[Couchdb Wiki] Update of "FrenchDict" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "FrenchDict" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/FrenchDict?action=diff=2=3 - RequestedDocumentation:: DocumentationDemandée
[Couchdb Wiki] Update of "FrontPageOld" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "FrontPageOld" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/FrontPageOld?action=diff=67=68 Comment: Older than dirt - ## page was renamed from FrontPage - ## Please edit system and help pages ONLY in the moinmaster wiki! For more - ## information, please see MoinMaster:MoinPagesEditorGroup. - ##master-page:FrontPage - #format wiki - #language en - #pragma section-numbers off - Welcome to [[http://incubator.apache.org/couchdb/|Apache CouchDB Project]] Wiki. - - Apache CouchDB is a distributed, fault-tolerant and schema-free document-oriented database accessible via a RESTful HTTP/JSON API. Among other features, it provides robust, incremental replication with bi-directional conflict detection and resolution, and is queryable and indexable using a table-oriented view engine with !JavaScript acting as the default view definition language. - - For more information see: - - * [[http://incubator.apache.org/couchdb/docs/intro.html|Introduction]] - * [[http://incubator.apache.org/couchdb/docs/overview.html|Technical Overview]] - * [[http://svn.apache.org/repos/asf/incubator/couchdb/trunk/README|README]] - * [[http://svn.apache.org/repos/asf/incubator/couchdb/trunk/NEWS|NEWS]] - * [[Presentations]] - - == Basics == - - * BasicsAll - * GettingStartedWithFuton - The CouchDB Web Administration Frontend - * GettingStartedWithAmazonEc2 - * GettingStartedWithExtJS - * GettingStartedWithCee - * GettingStartedWithCeeSharp - * GettingStartedWithErlang - * GettingStartedWithHaskell - * GettingStartedWithJava - * GettingStartedWithJavaScript - * GettingStartedWithLisp - * GettingStartedWithLotusScript - * GettingStartedWithObjectiveCee - * GettingStartedWithPerl - * GettingStartedWithPhp - * GettingStartedWithPython - * GettingStartedWithRuby - * GettingStartedWithSmalltalk - * GettingStartedWithVmware - - == How-To Guides == - - * HowToImplementTagging - * HowToPageThroughResults - * HowToCreateTests - - == Reference == - - * FrequentlyAskedQuestions - * TalkingPoints - * ErrorMessages - * [[Troubleshooting]] - * ConfigurationFileCouchIni - * ConfiguringDistributedSystems - * FilesystemBackups - * [[Views]] - * DocumentRevisions - * ViewCollation - * ViewServer - * UriTemplates - * ApiCheatSheet - * HttpDatabaseApi - * HttpDocumentApi - * HttpRestApi - * HttpStatusList - * HttpViewApi - * BreakingChanges - * [[Compaction]] - * ReservedWords - * ServingApplications - * RegeneratingViewsOnUpdate - * HierarchicalData - - == Installation == - - CouchDB is nearing an 0.9.x release, so there are some features documented on the wiki that are not available in the 0.8.1 release. Things are moving fast around here -- we recommend following svn trunk for users who'd like to keep up with the latest. - - * InstallingSpiderMonkey - * InstallingOnRhel4 - * InstallingOnRhel5 - * InstallingOnFedora7 - * InstallingOnGentoo - * InstallingOnUbuntu - * InstallingOnOpenSolarisAndJoynetAccellerator - * [[InstallingOnOSX]] - * InstallingOnWindows - - == Development == - - * [[Contributing]] - * BranchManagement - * ReleaseProcedure - * InTheWild - * RelatedProjects - * OpenItems - * OneLaptopPerChild - * FullTextSearch - * ActionServerProposal - * FullTextIndexWithView - - == Libraries == - - * StoringGeoData (PHP, Google Geocoding Service) - - == Community == - * PeopleOnTheCouch - - == Help == - - A Wiki is a collaborative site, anyone can contribute and share. - - See HelpForBeginners to get you going or HelpContents for all help pages. - - This is a work in progress, so feel free to help out and edit anything which you feel needs improvement. - - If there is something missing, feel free to edit RequestedDocumentation. - - Be aggressive with your edits! It's easier to ask forgiveness than permission, so have at it. -
[Couchdb Wiki] Update of "FullTextSearch" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "FullTextSearch" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/FullTextSearch?action=diff=12=13 Comment: very outdated - #redirect Full_text_search - == Fulltext Indexing and Searching == - CouchDB comes with fulltext indexing support using [[http://lucene.apache.org|Apache Lucene]] as a reference implementation. The integration is modular and allows any fulltext search technology to be used in combination with CouchDB. - === Index interface === - - CouchDB uses stdio for interfacing to the search engine,whenever a document is changed the name of the database - containing the document is sent to stdout. - - CouchDB does not expect to receive anything on stdin (read: it will crash if it does). - - setup - - The indexer is started by CouchDB using the command line specified in - the couch.ini configuration parameter: - - {{{ - DbUpdateNotificationProcess - }}} - - - === Search interface === - - CouchDB again uses stdio to interface to the searcher part. - - Currently this interface is not exposed through Futon, so to try it out you need to - start CouchDB with the - interactive option -i to get an Erlang shell. - - From there you can write search queries like: - - {{{ - couch_ft_query:execute("database", "+ query +string"). - }}} - - - For this example the string "database\n" followed by "+ query +string\n" is - transmitted to stdout. - - The result must follow this exact scheme to ensure that CouchDB understands - it. The first line must be "ok\n". The next two lines contain the id of the - highest ranking document that matches the query and the score or rank: - "docid1\n7\n". These two lines are repeated for all matching documents. - The end of the result must be signaled with an empty newline "\n\n". - - In case of an error, the first line consists of "error\n" and the second - line of the error message: "Invalid Foo Condition\n". - - setup - The searcher is started by CouchDB using the command line specified in - the couch.ini configuration parameter: - - {{{ - FullTextSearchQueryServer - }}} - - - === Lucene reference implementation === - - RFC: Use of special design document - Please not that this is currently in discussion and not actually set in code. - A database to index must contain a special design document in this format: - - {{{ - { - "_id":"_design/fulltextsearch", - "_rev":"123", - "fulltext_options": { - "views": { - "names" : {"index":"view-value", "return":"document"}, - "cities": {"index":"view-key", "return":"view"} - } - } - } - }}} - - The Lucene indexer uses the defined views in this document to guide the indexing - process. - - In this example the views "names" and "cities" must also be defined in the database. - Lucene will index the "view-value" for the "names" view and return documents as - search results, - for the "cities" view it will index the view-key and return the view in search results. - - For info on views in CouchDB see: [[Views]] - - - Dependencies - The Lucene indexer depends on these projects .jar files to work - * couchdb4j.jar (see below) -* commons-beanutils.jar -* commons-codec-1.3.jar -* commons-collections.jar -* commons-httpclient-3.1.jar -* commons-lang.jar -* commons-logging-1.1.jar -* ezmorph-1.0.3.jar -* json-lib-2.0-jdk15.jar - * lucene-core-2.3.1.jar - - Note: all the couchdb4j dependencies (as you can see some have not - version info supplied) is probably easily checked out from the - couchdb4j repository (see below). - - Note: at this time of writing couchdb4j needs to be patched using the patches - specified in issue 6 and 8 - on the coucdb4j issue tracking list: - - http://code.google.com/p/couchdb4j/issues/list - - So checkout trunk patch and build. - - At least Java version 5 is needed. - - Compiling - The Lucene search engine is not build as part of the CouchDB. - - You need to: - * setup a Java developer environment (at least version 5). - * Checkout CouchDB source. - * Change directory to src/fulltext/lucene - * Compile using javac with CLASSPATH with the needed dependencies (listed above) - * Do: jar cf !CouchLucene.jar *.class - - As result you should get a file !CouchLucene.jar to include in your CLASSPATH at - runtime. - - Runtime setup - You need a path to your java runtime (at least version 5). - You have to setup your java CLASSPATH to contain all the .jar files listed in the - dependency list, - alternatively you can specify it on the command line defined for the .ini options like: - - {{{ - FullTextSearchQueryServer=java -cp /path/to/couchdb4j/lib/couchdb4j.jar:... - LuceneSearcher - DbUpdateNotificationProcess=java -cp /path/to/couchdb4j/lib/couchdb4j.jar:... - LuceneIndexer - }}} - - Note above example works on Unix like
[Couchdb Wiki] Update of "Full_text_search" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Full_text_search" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Full_text_search?action=diff=13=14 Comment: this is also very outdated - <> - == Full-text Indexing and Searching == - - === Lucene === - Lucene integration with CouchDB is available with an external project called couchdb-lucene (http://github.com/rnewson/couchdb-lucene). - - === ElasticSearch === - [[http://www.elasticsearch.org|elasticsearch]] is an open source, distributed, RESTful, Search Engine. - - ElasticSearch integration with CouchDB is possible by using an Elasticsearch couchdb river plugin - - Links - * Setup details at : http://www.elasticsearch.org/tutorials/2010/08/01/couchb-integration.html - * http://www.elasticsearch.org/blog/2010/09/28/the_river.html - * http://www.elasticsearch.org/blog/2010/09/28/the_river_searchable_couchdb.html - * http://www.elasticsearch.org/guide/reference/river/couchdb.html -
[Couchdb Wiki] Update of "Futon_Chrome_Bookmark_App" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Futon_Chrome_Bookmark_App" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Futon_Chrome_Bookmark_App?action=diff=3=4 Comment: Outdated and futon is dead. - <> - = Futon Chrome Bookmark App = - - This is really nothing more than a glorified bookmark to your local Futon instance. It is accessible from the ''"New Tab"'' window in Chromium-based browsers (which includes Google Chrome). - - This is a screenshot of how it looks. - - {{attachment:preview.png|Preview|width=400}} - - == Installation == - - Due to Google's Chrome Web Store policies it is not possible to install it like you would normally install such an app. You'll either have to install the Futon.crx file by dragging it into a Chrome window or by downloading the zip archive, unzipping it and then loading it from Chrome's Tools page. I'll describe both ways. - - === Installing Futon.crx === - - This should be fairly easy. - - 1. Download [[attachment:Futon.crx|Futon.crx|=get]] ~-(by clicking on it)-~. - 2. Make sure a Chrome window is open ~-(any window will work)-~. - 3. Drag 'n drop the `Futon.crx` file into that window. - 4. Approve - 5. Win - - === Installing it from source === - - Don't be afraid, it is not the Linux kernel. - - 1. Download [[attachment:Futon.zip|Futon.zip|=get]] ~-(by clicking on it)-~. - 2. Unzip it ~-(and remember where you unzipped it)-~. - 3. In Chrome, go to `Tools` → `Extensions`. - 3.1 In case the `Developer Mode` checkbox in the upper right corner is not checked do so now. - 4. Click the `Load Unpacked Extension` button. - 5. Select the unzipped Futon directory. - 6. Win - - == Source Code == - - Additionally you can view/modify/grab the source code of the `manifest.json` from [[https://gist.github.com/3852988|this]] GitHub Gist and the image from below. - - {{attachment:icon_128.png|Futon Icon}} -
[Couchdb Wiki] Update of "GabrielBirke" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "GabrielBirke" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/GabrielBirke?action=diff=2=3 - #format wiki - #language de - == Gabriel Birke == - Meine persönliche Seite mit Links zu häufig benutzen Seiten - - * [[HTTP_Document_API]] - - - CategoryHomepage -
[Couchdb Wiki] Update of "Generating HTML from Javascript shows and lists" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Generating HTML from Javascript shows and lists" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Generating%20HTML%20from%20Javascript%20shows%20and%20lists?action=diff=9=10 Comment: This is really outdated...and shows/lists are semi-deprecated. - <> - = Generating HTML from Javascript shows and lists = - You can generate output from [[http://guide.couchdb.org/draft/show.html|shows]] and [[http://guide.couchdb.org/draft/transforming.html|lists]]. Typically this would be HTML intended for a browser but any format can be generated. CouchDB already includes [[http://en.wikipedia.org/wiki/ECMAScript_for_XML|Javascript support]] for XML derived formats (eg Atom feeds). It is impractical to output HTML directly so some sort of templating is recommended. - - As of the 0.11 release of CouchDB you can use CommonJS 1.0 modules in your show, list, update, and validation functions - see [[CommonJS_Modules]]. - - == Best Practise == - Generate clear concise simple HTML from your show/list functions. The resulting HTML interface should be usable from constrained devices (eg cell phones, set top boxes) as well as being accessible (eg screen readers) and easy to index for search engines. This is also easier to automatically test. You can then run Javascript in the browser (if the browser supports Javascript and it is turned on) to enhance what is being displayed (eg add extra information, tooltips, icons, previews of next/previous content, enhanced menus and interaction etc). - - It is a '''very''' good idea to use a library that automatically escapes values (eg replacing < with ampersand lt semicolon) otherwise your application will be prone to [[http://en.wikipedia.org/wiki/Cross-site_scripting|cross site scripting attacks]]. It should also provide a way of disabling the escaping when you are intentionally providing raw HTML. - - It is convenient if the library has functions for emitting html. For example it may have a function to insert an image where you provide the URL and the function generates all the wrapping HTML, including width/height/caption attributes if you provided them. - - . '''Bad''': `` - - . '''Good''': `{{ img_tag(url, width, height) }}` - - You should avoid having code in your template. Some template libraries let you put any code you want between their tags. This is as bad an idea as putting HTML sprinkled throughout your code. It also makes the templates harder to translate (the translator has to understand the code) and is a maintenance burden (eg if you have similar code in multiple templates then they may all require changing for code updates). Instead you should be able to define a meaningfully named function that is part of the data supplied to the template. - - . '''Bad''': `{{ if(info_level>3 && info_items.length>0 && show_issues) }} Important issues ... {{/if}}` - - . '''Good''': `{{ if (has_important()) }} Important issues ... {{/if}}` - - == Constraints == - The Javascript view server and the environment the code run in mean that some existing Javascript templating libraries will not work. - - * There is no network/file access so templates cannot be loaded over the network or from a file. Instead they must be strings already included into your Javascript code. (See the !json directive of couchapp which does this for you). They must also return strings. - * There is no [[http://en.wikipedia.org/wiki/Document_Object_Model|DOM]] available (templating libraries often assume that they are running in a browser working on the currently displayed document) - * Some work on complete documents whereas your show and especially list functions are often working on multiple strings and template fragments - * Some only do HTML - this is good if they ensure the result is correct HTML - * Some do any form of templating (eg plain text) which means your resulting HTML can be invalid - * Size can be a problem. Some templating libraries are rather large and depend on other libraries. They can create many layers of intermediary functions and caching making it hard to debug what is happening. - - == Solutions == - The solutions listed below are known to work with CouchDB show and list functions, generating HTML and working with CouchDB deployment conventions (ie !json string templates and !code inclusion into the show/list functions). - - . '''Recommendation: '''Use mustache.js - - === John Resig's micro-templating === - This engine is a screenful of code described at http://ejohn.org/blog/javascript-micro-templating (download a CouchDB version [[http://github.com/Damienkatz/TeaTime/raw/master/vendor/couchapp/template.js|here]]). You can read about using it in the [[http://books.couchdb.org/relax/design-documents/shows#Using%20Templates|CouchDB book]]. Example usage can be
[Couchdb Wiki] Update of "GaganSaksena" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "GaganSaksena" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/GaganSaksena?action=diff=7=8 Comment: We already have a "Cookbook for SQL jockeys" - #format wiki - #language en - == Gagan Saksena == - Some recipes/notes from using CouchDB. These could be valuable someday for others navigating their way in these waters. For now mostly a placeholder for things I'm learning. This is '''work in progress'''! - Handy shortcuts - There are a number of handy shortcuts for doing standard reduce tasks- Checkout [[Built-In_Reduce_Functions]] for more details. - - === SQL Recipes in Map/Reduce === - A collection of handy recipes to do common tasks in map/reduce. This page is still in development- checkout this book's page for some useful details- [[http://books.couchdb.org/relax/reference/views-for-sql-jockeys|Views for SQL jockeys]] - - For the purpose of these recipes- the equivalent SQL table looks like this- - - {{{ - CREATE TABLE Foo ( - Name CHAR(256), - Age INTEGER, - StartDate DATE - ); - }}} -
[Couchdb Wiki] Update of "GettingStarted" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "GettingStarted" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/GettingStarted?action=diff=4=5 Comment: we don't need no stinkin' index - * [[Getting_started_with_Amazon_EC2]] - * [[Getting_started_with_ExtJS]] - * [[Getting_started_with_C]] - * [[Getting_started_with_C#]] - * [[Getting_started_with_Erlang]] - * [[Getting_started_with_Futon]] - * [[Getting_started_with_Haskell]] - * [[Getting_started_with_Java]] - * [[Getting_started_with_JavaScript]] - * [[Getting_started_with_LISP]] - * [[Getting_started_with_LotusScript]] - * [[Getting_started_with_Lua]] - * [[Getting_started_with_Objective-C]] - * [[Getting_started_with_Perl]] - * [[Getting_started_with_PHP]] - * [[Getting_started_with_PL_SQL]] - * [[Getting_started_with_Python]] - * [[Getting_started_with_Ruby]] - * [[Getting_started_with_Smalltalk]] - * [[Getting_started_with_VMware]]
[Couchdb Wiki] Update of "Getting Help" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Getting Help" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Getting%20Help?action=diff=3=4 Comment: Already duplicated elsewhere - <> - Please follow these steps if you have questions, think you have found a bug or have any other comments about CouchDB. - - === Has it happened before or already been answered? === - 1. Search the mailing lists. Enter search terms at [[http://couchdb.markmail.org/|http://couchdb.markmail.org]] - 1. Search the bug tracking system at https://issues.apache.org/jira/browse/COUCHDB - 1. The [[http://wiki.apache.org/couchdb/|wiki]] also has many useful guides and can also be searched (look in top right) - - === Preparing your question === - In order for people to help you, please prepare your question. Your goal is for the people who can answer to understand what you are doing with CouchDB, what you see and what you expected to see. You should also include platform information (eg Windows or Linux), version information (which version of Couchdb), libraries and tools in use (eg are you talking directly to CouchDB using curl or a library such as [[http://code.google.com/p/couchdb-python/|python-couchdb]]). These two links are helpful guides: - - * [[http://catb.org/~esr/faqs/smart-questions.html|How to ask smart questions]] - * [[http://www.chiark.greenend.org.uk/~sgtatham/bugs.html|How to report bugs effectively]] - - === Asking the question === - The best place to get help, ask questions and receive answers is the [[http://couchdb.apache.org/community/lists.html|CouchDB users mailing list]]. Please post your question in only one place. (If you post it in multiple places then answerers won't see each others responses, people will be discouraged from answering suspecting they will be duplicating answers elsewhere, followups are fragmented etc.) - - Make sure you will be able to see answers before posting. For example you may want to subscribe to the mailing list, or bookmark the [[http://thread.gmane.org/gmane.comp.db.couchdb.user/|GMane page]]. Ensure you keep checking back. You should see answers or there may be more questions asking for further information in order to provide a better answer. It is appreciated if you respond in a timely manner. - - Once the issue or question is resolved it may be appropriate to post a followup summary. Imagine that someone else in the future had the same thoughts as you so make the post easy to find via searches and for them to understand the resolution. For example it may have been a bug in your code so you can say how to test for it or prevent it in the future, or it may be a bug in CouchDB in which case point to the ticket, or a wiki page may have been updated or created. -
[Couchdb Wiki] Update of "GitSuccessCriteria" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "GitSuccessCriteria" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/GitSuccessCriteria?action=diff=14=15 Comment: Git has now happened! Hooray. - = Criteria for GIT @ ASF = - This list describes all points which MUST be met for GIT to become an accepted SCM for ASF projects. - . The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [[http://www.ietf.org/rfc/rfc2119.txt|RFC 2119]]. - - == Technical == - 1. The preservation of the commit history MUST be guaranteed. It SHOULD be practically impossible to delete, tamper with, or alter any piece of commit history which made it into an official ASF release. - 1. Changes MUST be submitted by an authenticated committer, over a secure connection. It SHOULD not be possible to fake the committer id and thus taint the commit history. - 1. In cases where the committer is not the author, the committer is REQUIRED to ensure that the author has granted the code to the ASF under the terms of the [[http://www.apache.org/licenses/LICENSE-2.0|Apache License]] or that the contribution is sufficiently trivial to waive this requirement. - 1. The single canonical project repository (repositories) MUST be hosted on ASF servers under full control of the ASF infra team. - 1. There MUST be no other legal problem because of the usage of GIT as canonical repository. - 1. The canonical GIT repo hosted at the ASF MUST be the repo to cut official ASF releases from. - 1. ASF Infrastructure MUST provide backups of the repository and MUST be able to guarantee reasonable uptime of the services. - 1. A set of community policies or procedures SHALL be defined, and the community SHALL review them to ensure that any impact due to GIT implementation is either mitigated or accepted. - - == Community Policies and Procedures == - 1. How committers are RECOMMENDED To handle branches, including development, feature, official releases, and maintenance branches. - 1. How to handle security@ issues, and what material SHOULD NOT be committed to the repository. - 1. A documented and accepted Release procedure MUST be defined and followed. - 1. It is RECOMMENDED that a clear community contribution process is made available. - - == Relevant discussions and documents == - . The following are links to the official ASF CouchDB mailing list archives. You can click on arrows in the right-hand side to view replies. - - [[http://mail-archives.apache.org/mod_mbox/couchdb-dev/201109.mbox/<400b8fd70f37440e98f7d00632936...@gmail.com>|Disabling svn access 2011/09/23]] - -
[Couchdb Wiki] Update of "GitJiraIntegration" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "GitJiraIntegration" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/GitJiraIntegration?action=diff=3=4 Comment: JIRA is dead, thankfully. - Many ASF projects use JIRA as an issue tracker (see [[https://issues.apache.org/jira/secure/BrowseProjects.jspa#all|JIRA at issues.apache.org]]). CouchDB is one such project which also happens to be the project selected for experimenting with Git at the ASF. Improving the community contribution workflow for the CouchDB project by demonstrating good integration JIRA and Git will help to ensure that the CouchDB Git experiment is deemed a success and ensure a low barrier to community contribution. - There is an INFRA ticket open to set up the Git plugin for JIRA ([[https://issues.apache.org/jira/browse/INFRA-4157|INFRA-4157]]). - - The Cassandra project has [[https://wiki.apache.org/cassandra/GitAndJIRA|some documentation and scripts]] to help managing patch series in JIRA and Git. -
[Couchdb Wiki] Update of "Git_At_Apache_Guide" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Git_At_Apache_Guide" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Git_At_Apache_Guide?action=diff=35=36 Comment: This is also outdated - This page collects the guidelines established in the git experiment. - This is a work in progress. - - ASF GIT repositories are currently hosted at http://git-wip-us.apache.org/ - - For understanding the technical aspects of GIT and SVN please read [[SVNvsGIT]]. This will help you to grok the design decisions. - - GIT at the ASF is currently an experiment. We have defined criteria under which this experiment should be considered [[GitSuccessCriteria|successful]]. - - == Hosting == - Canonical GIT repositories for Apache projects must be hosted on ASF hardware, under full control of the ASF infrastructure. This has quite a few reasons: - - 1. Our Source Code Repositories are there for one reason: helping the community. This can best be supported by having one single canonical repository. Projects having multiple equitable repository clones tend to split the community. - 1. UserIDs outside of apache.org are not reliable! We can only guarantee a fully trusted authentication for servers we host ourselves! - 1. Authentication can later be extended to support login via ssh keys uploaded to http://id.apache.org (we need to drop this as infra ticket) - 1. Relying on external infrastructure for our own core business is frankly spoken pretty unwise. This would not only split the community but also would us make lose our independence. We would have no access to the underlying hardware, thus no way to handle threats if someone tries to taint our repositories. - - == Project Structure == - 1. Each project has at least one GIT repository which contains the main project and is read/writable for all committers. - 1. Each project can optionally have a separated PMC-private GIT repository which conains confidential legal stuff like trademark contracts, creds for community accounts like twitter, etc - 1. Some projects might need additional GIT repositories containing project parts which have a completely separated lifecycle from the main project. This can be various build-tools (checkstyle-rules, project specific maven-plugins which are needed to build the project) or the project site. This is needed because a GIT branch and tag always affects the whole repository - - == GIT Hooks == - We need to apply some hooks to the GIT repos to prevent the user from changing a few things. - - 1. It must not be possible to change the history of a project or delete certain branches. Any sha1 in master or any productive branch must not be allowed to get changed! - 1. git-rebase, git-stash and stashing via git-merge --interactive is only allowed if the history of external contributions remains preserved. - 1. It must not be possible to delete release tags. - - ''grobmeier: deleting tags is possible with SVN, for example when the RC1 tag has failed the vote. Why isn't it allowed with git?'' - - - == Non-ASF repository collaboration == - 1. Doing a test feature branch in private or in a forked github repository is perfectly fine. But committers should push to the canonical ASF repository early and often to prevent a fragmentation of the community development effort. - 1. Even if GIT supports the additional author information, the established policy that committers should apply their commits to the canonical repository themself remains intact. - 1. Committers pushing changes to the canonical repository must make sure that the committerIds and authorIds in the changes they submit are trustworthy (authenticated and iCLA on file). - 1. Pulling from some external (non apache.org hosted) repository must only happen if all the respective commits are done by a person which has an iCLA on file and if the diff of the pull-request is preserved on some ASF server. This can be done by extending JIRA to automatically download the diffs of a pull-request.The project shall not hesitate to animate people to sign our iCLA. - 1. Incorporating changes from other contributors (no iCLA on file) must only be handled via JIRA attached patches because of legal reasons (the 'grant inclusion under ALv2' flag in JIRA). - 1. The project documentation and project site shall mention the apache.org based GIT repo as the canonical source location. - - == Cutting Releases with GIT == - - The release plan from couchdb can be found here: http://wiki.apache.org/couchdb/Release_procedure - - Apache Maven supports the usage of GIT with the [[http://maven.apache.org/scm/git.html|maven-scm-providers-git]] since 2008. - - Be aware that the branch created by a release with GIT always covers the whole repository. - - === Tagging during a VOTE === - Please note that the __only__ officially result of an ASF release is the __source tarball__! These zipped
[Couchdb Wiki] Update of "Hackathon" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Hackathon" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Hackathon?action=diff=4=5 Comment: way outdated - = Vienna Hackathon 2013 = - <> - < > - - See the main site [[http://www.couchhack.org/|CouchHack]] for dates and organisation details. Below is the to-do list in action. - - == working list == - - Who wants to work on what for the Vienna 2013 Hackathon? Just add your entries below to a new list item, or join an existing item. - - * Merge All The Forks (rcouch, bigcouch) [[DaveCottlehuber]] [[BenoitC]] [[JanLehnardt]] - see thread on mailing list for actual approach - * Align Build system around merge (erlang.mk or rebar) [[DaveCottlehuber]] - as side effect it should make building on Windows the same as other platforms by using the existing rebarised NIFs (ejson, snappy already completed) -
[Couchdb Wiki] Update of "HackingFuton" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HackingFuton" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HackingFuton?action=diff=4=5 Comment: way outdated - <> - == A Caveat == - - If you're running a version of CouchDB that's too out of date, Futon might do weird things. The entire point of this exercise is to make sure that you don't need to build CouchDB by hand just to hack on Futon though, so I'll just leave it as an exercise to the reader to keep things in sync. I'll post corresponding SVN URL's towards the bottom. - - == Bleeding Edge Instructions == - - {{{ - $ svn co http://svn.apache.org/repos/asf/couchdb/trunk/share/www futon - $ wget http://github.com/davisp/futonproxy/raw/617b47b138a5ce5ddece13db16f6ac7ca1ba192f/futonproxy.py - $ chmod +x futonproxy.py - $ ./futonproxy.py futon - }}} - - Assuming CouchDB is running on http://127.0.0.1:5984 you can just open a web browser and point it to http://127.0.0.1:8080/_utils/. - - == Futon Proxy == - - The latest version of Futon Proxy is at [[http://github.com/davisp/futonproxy|GitHub]] - - == Getting trunk without building == - - If you're on Mac OS X 10.5 or newer, there are single click installers available to use. These directions should work just fine if you would like to use one of those. The installers can be found on [[http://github.com/janl/couchdbx-core/downloads|GitHub]] - - == Futon Versions == - - If you're using an older version of CouchDB to run Futon against, you can check out a closer version of the HTML sources by adjusting the SVN url. - - {{{ - # 0.10.x - $ svn co http://svn.apache.org/repos/asf/couchdb/branches/0.10.x/share/www futon - # 0.9.x - $ svn co http://svn.apache.org/repos/asf/couchdb/branches/0.9.x/share/www futon - # 0.8.x - # Time to upgrade! - }}} -
[Couchdb Wiki] Update of "HierarchicalData" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HierarchicalData" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HierarchicalData?action=diff=4=5 - #redirect How_to_store_hierarchical_data - = Storing Hierarchical Data in CouchDB = - For the original article this example was taken from, see http://blog.paulbonser.com/2008/07/04/storing-hierarchical-data-in-couchdb/ - For comparison with how this is usually done with relational DBs, see http://www.sitepoint.com/article/hierarchical-data-database/ - - == Storing the Tree == - - Store the full path to each node as an attribute in that node's document. - - For example: - - {{{ - [ - {"_id":"Food", "path":["Food"]}, - {"_id":"Fruit", "path":["Food","Fruit"]}, - {"_id":"Red","path":["Food","Fruit","Red"]}, - {"_id":"Cherry", "path":["Food","Fruit","Red","Cherry"]}, - {"_id":"Tomato", "path":["Food","Fruit","Red","Tomato"]}, - {"_id":"Yellow", "path":["Food","Fruit","Yellow"]}, - {"_id":"Banana", "path":["Food","Fruit","Yellow","Banana"]}, - {"_id":"Meat", "path":["Food","Meat"]}, - {"_id":"Beef", "path":["Food","Meat","Beef"]}, - {"_id":"Pork", "path":["Food","Meat","Pork"]} - ] - }}} - - In a real system you'd probably want to use some sort of UUID instead of descriptive strings, since conflicts between node names could be bad. In fact, it'd probably be much faster to just use numbers, since comparisons on numbers are generally much faster. For the purposes of this example, however, it's much easier to understand if it's descriptive text. - - Once that data is in your DB, it's time to get it out again! - - == Retrieving the whole tree == - - The CouchDB map function to retrieve the whole tree is nice and simple: - - {{{ - function(doc) { - emit(doc.path, doc) - } - }}} - - Using the path as the key, the documents will be sorted as above, with each parent immediately followed by its children. - - One option to get the data into an actual tree would be to add a reduce function to the view: - - {{{ - function(keys, vals) { - tree = {}; - for (var i in vals) - { - current = tree; - for (var j in vals[i].path) - { - child = vals[i].path[j]; - if (current[child] == undefined) - current[child] = {}; - current = current[child]; - } - current['_data'] = vals[i]; - } - return tree; - } - }}} - - 'Note: don't use this reduce function, since it doesn't take the rereduce parameter into account, and would most likely not work correctly if a rereduce was done.' - - Another option would be to use a client-side function to accomplish the same thing, for example in Python: - - {{{#!python - class TreeNode(dict): pass - - def tree_from_rows(list): - tree = {} - for item in list: - current = tree - for child in item.value['path']: - current = current.setdefault(child, TreeNode()) - current.data = item.value - return tree - }}} - - This code does the job nicely and allows me to use the same function to build a tree from several different views without duplicating code. - - == Getting a subtree == - - To get all the nodes which are underneath a specific node, I implemented the view's reduce function as follows: - - {{{ - function(doc) { - for (var i in doc.path) { - emit([doc.path[i], doc.path], doc) - } - } - }}} - - Again, this is pretty simple. The only difference from the last view is that I can now query this view with a startkey and endkey (see the HttpViewApi) to get only nodes under a certain node. You could actually do that with the previous view, except you'd have to include the full path to the node in the startkey, which is a bit too much. - - For example, if you had CouchDB running on your machine right now with the above example data loaded and went to http://localhost:5984/tree/_view/tree/descendants?startkey=[%22Fruit%22]=[%22Fruit%22,{}] - - == How Many Descendants == - - Getting the number of descendants for a given node is simple. The view is as follows: - - {{{ - 'descendant_count': { - 'map':'function(doc) { for (var i in doc.path) { emit(doc.path[i], 1) } }', - 'reduce': 'function(keys, values) { return sum(values) }' - } - }}} - - This will count the parent node as well, so you will probably want to subtract one from it at some point. To use this view simply call it with the key parameter set to the id of the desired root node. - - == Getting the immediate children of a node == - - Sometimes you just want to get a list of nodes which are immediately under a given node. This can be done by using a map with the following map function: - - {{{ - function(doc) { - emit([doc.path.slice(-2,-1)[0], doc.path], doc) - } - }}} - - This map function simply takes the second-to-last
[Couchdb Wiki] Update of "HttpDatabaseApi" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HttpDatabaseApi" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HttpDatabaseApi?action=diff=8=9 - #redirect HTTP_database_API - An introduction to the CouchDB HTTP database API. - == Naming and Addressing == - - A database must be named with all lowercase characters (a-z), digits (0-9), or any of the ''_$()+-/'' characters and must end with a slash in the URL. The name has to start with characters. - - {{{ - http://couchserver/databasename/ - http://couchserver/another/databasename/ - http://couchserver/another/database_name(1)/ - }}} - - ''Uppercase characters are NOT ALLOWED in database names.'' - - {{{ - http://couchserver/DBNAME/ (invalid) - http://couchserver/DatabaseName/ (invalid) - http://couchserver/databaseName/ (invalid) - }}} - - Note also that a ''/'' character in a DB name must be escaped when used in a URL; if your DB is named ''his/her'' then it will be available at ''http://localhost:5984/his%2Fher''. - - ''Rationale for character restrictions'' - - The limited set of characters for database names is driven by the need to satisfy the lowest common denominator for file system naming conventions. For example, disallowing uppercase characters makes compliance with case insensitive file systems straightforward. - - == List Databases == - - To get a list of databases on a CouchDB server, use the ''/_all_dbs'' URI: - - {{{ - GET /_all_dbs HTTP/1.01 - Date: Thu, 17 Aug 2006 05:39:28 +GMT - }}} - - And the response: - - {{{ - HTTP/1.1 200 OK - Date: Thu, 17 Aug 2006 05:39:28 +GMT - Content-Length: 37 - Content-Type: application/json - Connection: close - - ["somedatabase", "anotherdatabase"] - }}} - - == PUT (Create New Database) == - - To create a new empty database, perform a PUT operation at the database URL. Currently the content of the actual PUT is ignored by the webserver. - - On success, HTTP status ''201'' is returned. If a database already exists a ''409'' error is returned. - - {{{ - PUT /somedatabase/ HTTP/1.0 - Content-Length: 0 - Date: Thu, 17 Aug 2006 05:39:28 +GMT - }}} - - Here is the server's response: - - {{{ - HTTP/1.1 201 OK - Date: Thu, 17 Aug 2006 05:39:28 +GMT - Content-Length: 13 - Content-Type: application/json - Connection: close - - {"ok": true} - }}} - - == DELETE == - - To delete a database, perform a DELETE operation at the database location. - - On success, HTTP status ''200'' is returned. If the database doesn't exist, a ''404'' error is returned. - - {{{ - DELETE /somedatabase/ HTTP/1.0 - Content-Length: 1 - Date: Thu, 17 Aug 2006 05:39:28 +GMT - }}} - - Here is the server's response: - - {{{ - HTTP/1.1 200 OK - Date: Thu, 17 Aug 2006 05:39:28 +GMT - Content-Length: 67 - Content-Type: application/json - Connection: close - - {"ok": true} - }}} - - == Database Information == - - To get information about a particular database, perform a GET operation on the database, e.g.: - - {{{ - GET /somedatabase/ HTTP/1.0 - }}} - - The server's response is a JSON object similar to the following: - - {{{ - {"db_name": "dj", "doc_count":5, "doc_del_count":0, "update_seq":13, "compact_running":false, "disk_size":16845} - }}} - - == Compaction == - - Databases may be compacted to reduce their disk usage. For more details, see [[Compaction]]. -
[Couchdb Wiki] Update of "History" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "History" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/History?action=diff=7=8 Comment: nice idea but it never happened. - = Proposal for CouchDB history support = - * Every time a document is changed, store the existing document as an attachment before writing the updated document. - * For space efficiency, historical attachments are stored separately i.e. not inline with the historical JSON document. - * The special "history" attachments will be stored using a special prefix of "_history/<_rev>". - * If people need to add meta-data to the history, e.g. "last changed by", "last changed date/time", then the recommended way would be to use a custom _update handler to add these fields to the doc being saved, and these would propagate to the history attachment. - * In future we can add delta support to further improve efficiency. - - == Use cases == - - The main use case we want to support is the ability to recover from catastrophic user errors e.g. if they delete an important document, or overwrite something important. I don't think supporting use cases such as rolling back to particular snapshots is within the scope of this proposal. - - == Implementation == - - Native Erlang patch to core CouchDB. We probably want the ability to turn this on/off on a per-db basis via a .ini config option. -
[Couchdb Wiki] Update of "HttpStatusList" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HttpStatusList" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HttpStatusList?action=diff=4=5 - #redirect HTTP_status_list - A list of HTTP statuses used by CouchDB and their respective meanings. - === 200 - OK === - - Request completed successfully. - - === 304 - Not Modified === - - Etag not modified since last update. - - === 400 - Bad Request === - - Request given is not valid in some way. - - === 404 - Not Found === - - Such as a request via the HttpDocumentApi for a document which doesn't exist. - - === 406 - Not Acceptable === - - Request contained invalid JSON. - - === 409 - Conflict === - - Request attempted to created database which already exists. - - === 412 - Precondition Failed === - - Request resulted in an update conflict. - - === 500 - Internal Server Error === - - Woops. - - ''As you can see, this document is incomplete, please update.''' -
[Couchdb Wiki] Update of "HttpDocumentApi" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HttpDocumentApi" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HttpDocumentApi?action=diff=33=34 - #redirect HTTP_Document_API - An introduction to the CouchDB HTTP document API. - == Naming/Addressing == - - Documents stored in a CouchDB have a DocID. DocIDs are case-sensitive string identifiers that uniquely identify a document. Two documents cannot have the same identifier in the same database, they are considered the same document. - - {{{ - http://localhost:5984/test/some_doc_id - http://localhost:5984/test/another_doc_id - http://localhost:5984/test/BA1F48C5418E4E68E5183D5BD1F06476 - }}} - - The above URLs point to ''some_doc_id'', ''another_doc_id'' and ''BA1F48C5418E4E68E5183D5B!D1F06476'' in the database ''test''. - - === Valid Document Ids === - - Q: What's the rule on a valid document id? The examples suggest it's restricted to ''[a-zA-Z0-9_]''? What about multi-byte UTF-8 characters? Any other non alphanums other than ''_''? - - A: There is no restriction yet on document ids at the database level. However, I haven't tested what happens when you try to use multibyte in the URL. It could be it "just works", but most likely there is a multi-byte char escaping/encoding/decoding step that needs to be done somewhere. For now, I'd just stick with valid URI characters and nothing "special". - - The reason database names have strict restrictions is to simplify database name-to-file mapping. Since databases will need to replicate across operating systems, the file naming scheme needed to be the lowest common denominator. - - == JSON == - - A CouchDB document is simply a JSON object. (Along with metadata revision info if ''?full=true'' is in the URL query arguments. - - This is an example document: - - {{{ - { - "_id":"discussion_tables", - "_rev":"D1C946B7", - "Subject":"I like Plankton", - "Author":"Rusty", - "PostedDate":"2006-08-15T17:30:12-04:00", - "Tags":["plankton", "baseball", "decisions"], - "Body":"I decided today that I don't like baseball. I like plankton." - } - }}} - - The document can be an arbitrary JSON object, but note that any top-level fields with a name that starts with a ''_'' prefix are reserved for use by CouchDB itself. Common examples for such fields are ''_id'' and ''_rev'', as shown above. - - Another example: - - {{{ - { - "_id":"discussion_tables", - "_rev":"D1C946B7", - "Subrise":true, - "Sunset":false, - "FullHours":[1,2,3,4,5,6,7,8,9,10], - "Activities": [ -{"Name":"Football", "Duration":2, "DurationUnit":"Hours"}, -{"Name":"Breakfast", "Duration":40, "DurationUnit":"Minutes", "Attendees":["Jan", "Damien", "Laura", "Gwendolyn", "Roseanna"]} - ] - } - }}} - - Note that by default the structure is flat; in this case, the ''Activities'' attribute is structure imposed by the user. - - == All Documents == - - To get a listing of all documents in a database, use the special ''_all_docs'' URI: - - {{{ - GET somedatabase/_all_docs HTTP/1.0 - Date: Thu, 17 Aug 2006 05:39:28 +GMT - }}} - - Will return a listing of all documents and their revision IDs, ordered by DocID (case sensitive): - - {{{ - HTTP/1.1 200 OK - Date: Thu, 17 Aug 2006 05:39:28 +GMT - Content-Type: application/json - Connection: close - - { - "total_rows": 3, "offset": 0, "rows": [ - {"id": "doc1", "key": "doc1", "value": {"rev": "4324BB"}}, - {"id": "doc2", "key": "doc2", "value": {"rev":"2441HF"}}, - {"id": "doc3", "key": "doc3", "value": {"rev":"74EC24"}} - ] - } - }}} - - Use the query argument ''descending=true'' to reverse the order of the output table: - - Will return the same as before but in reverse order: - - {{{ - HTTP/1.1 200 OK - Date: Thu, 17 Aug 2006 05:39:28 +GMT - Content-Type: application/json - Connection: close - - { - "total_rows": 3, "offset": 0, "rows": [ - {"id": "doc3", "key": "doc3", "value": {"_rev":"74EC24"}} - {"id": "doc2", "key": "doc2", "value": {"_rev":"2441HF"}}, - {"id": "doc1", "key": "doc1", "value": {"_rev": "4324BB"}}, - ] - } - }}} - - The query string parameters ''startkey'' and ''count'' may also be used to limit the result set. For example: - - {{{ - GET somedatabase/_all_docs?startkey=doc2=2 HTTP/1.0 - Date: Thu, 17 Aug 2006 05:39:28 +GMT - }}} - - Will return: - - {{{ - HTTP/1.1 200 OK - Date: Thu, 17 Aug 2006 05:39:28 +GMT - Content-Type: application/json - Connection: close - - { - "total_rows": 3, "offset": 1, "rows": [ - {"id": "doc2", "key": "doc2", "value": {"_rev":"2441HF"}}, - {"id": "doc3", "key": "doc3", "value": {"_rev":"74EC24"}} - ] - } - }}} - - And combined with ''descending'': - - {{{ - GET somedatabase/_all_docs?startkey=doc2=2=true HTTP/1.0 - Date: Thu, 17 Aug 2006 05:39:28 +GMT - }}} - - Will return: - - {{{ - HTTP/1.1 200 OK - Date: Thu, 17 Aug 2006 05:39:28 +GMT -
[Couchdb Wiki] Update of "HttpRestApi" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HttpRestApi" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HttpRestApi?action=diff=3=4 - #redirect HTTP_REST_API - The primary API for programmatically accessing the CouchDB store is a [[http://en.wikipedia.org/wiki/Representational_State_Transfer|REST]] API. - That's right, REST on the Couch. Doesn't that feel nice? Let me fetch you a lemonade and some slippers. - - See also: - - * HttpDatabaseApi - * HttpDocumentApi - * HttpViewApi -
[Couchdb Wiki] Update of "HttpViewApi" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HttpViewApi" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HttpViewApi?action=diff=26=27 - #redirect HTTP_view_API - An introduction to the CouchDB HTTP view API. - == Basics == - - Views are the primary tool used for querying and reporting on Couch documents. - - Views are defined with Javascript functions. Here is the very simplest function: - - {{{ - function(doc) { - emit(null, doc); - } - }}} - - See [[Views]] for more information. - - == Creating Views == - - To create a permanent view, the functions must first be saved into special ''design documents'' (well, they are not really special, we just call them special but in reality, they are regular documents, just with a special ID). The IDs of design documents must begin with ''_design/'' and have a special views attribute that have a ''map'' member and an optional ''reduce'' member to hold the view functions. All the views in one design document are indexed whenever any of them gets queried. - - A design document that defines ''all'', ''by_lastname'', and ''total_purchases'' views might look like this: - - {{{ - { - "_id":"_design/company", - "_rev":"12345", - "language": "javascript", - "views": - { - "all": { - "map": "function(doc) { if (doc.Type == 'customer') emit(null, doc) }" - }, - "by_lastname": { - "map": "function(doc) { if (doc.Type == 'customer') emit(doc.LastName, doc) }" - }, - "total_purchases": { - "map": "function(doc) { if (doc.Type == 'purchase') emit(doc.Customer, doc.Amount) }", - "reduce": "function(keys, values) { return sum(values) }" - } - } - } - }}} - - The ''language'' property tells CouchDB the language of the view functions, which it uses to select the appropriate ViewServer (as specified in your couch.ini file). The default is to assume Javascript, so this property can be omitted for Javascript views. - - == Altering/Changing Views == - - To change a view or multiple view just alter the document (see HttpDocumentApi) they are stored in and save it as a new revision. - - == Access/Query == - - Once this document is saved into a database, then the ''all'' view can be retrieved at the URL: - - http://localhost:5984/database/_view/company/all - - Example: - - {{{ - GET /some_database/_view/company/all HTTP/1.0 - Date: Thu, 17 Aug 2006 05:39:28 +GMT - }}} - - And will result in the following response: - - {{{ - HTTP/1.1 200 OK - Date: Thu, 17 Aug 2006 05:39:28 +GMT - Content-Length: 318 - Connection: close - - { - "total_rows": 3, - "offset": 0, - "rows": [{ - "id":"64ACF01B05F53ACFEC48C062A5D01D89", - "key": null, - "value": { - "LastName":"Katz", - "FirstName":"Damien", - "Address":"2407 Sawyer drive, Charlotte NC", - "Phone":012555754211 - } - }, { - "id":"5D01D8964ACF01B05F53ACFEC48C062A", - "key": null, - "value": { - "LastName":"Kerr", - "FirstName":"Wayne", - "Address":"123 Fake st., such and such", - "Phone":88721320939 - } - }, { - "id":"EC48C062A5D01D8964ACF01B05F53ACF", - "key": null, - "value": - { - "LastName":"McCracken", - "FirstName":"Phil", - "Address":"1234 Fake st., such and such", - "Phone":7766552342 - } - } - ] - } - }}} - - == Temporary Views == - - One-off queries (eg. views you don't want to save in the CouchDB database) can be done via the special view ''_temp_view''. Temporary views are only good during development. Final code should not rely on them as they are very expensive to compute each time they get called and they get increasingly slower the more data you have in a database. If you think you can't solve something in a permanent view that you can solve in an ad-hoc view, you might want to reconsider. (TODO: add typical examples and solutions). - - {{{ - POST /some_database/_temp_view HTTP/1.0 - Content-Length: 48 - Date: Mon, 10 Sep 2007 17:11:10 +0200 - Content-Type: application/json - - { - "map" : "function(doc) { if (doc.foo=='bar') { emit(null, doc.foo); } }" - } - - }}} - - Could result in the following response: - - {{{ - { - "total_rows": 1, - "offset": 0, - "rows": [{ - "id": "AE1AD84316B903AD46EF396CAFE8E50F", - "key": null, - "foo": "bar" - } - ] - } - }}} - - == Querying Options == - - Columns can be a list of values, there is no set limit to the number of values or amount of data that columns can hold. - - The following URL query arguments are allowed: - - * GET - * key=keyvalue - * startkey=keyvalue - * startkey_docid=docid - * endkey=keyvalue - * endkey_docid=docid - * count=max rows to return - *
[Couchdb Wiki] Update of "HTTP_view_API" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HTTP_view_API" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HTTP_view_API?action=diff=66=67 Comment: migrated - <> - = HTTP View API = - - See also the [[http://docs.couchdb.org/en/latest/api/design.html#get-db-design-design-doc-view-view-name|official documentation]] for this topic. - - < > - - An introduction to the CouchDB HTTP view API. - - == Basics == - Views are the primary tool used for querying and reporting on CouchDB databases. They are defined in !JavaScript (although there are other query servers available). For a more detailed introduction to views see [[Introduction_to_CouchDB_views]]. - - == Creating Views == - To create a permanent view, the functions must first be saved into special ''design documents'' (well, they are not really special, we just call them special but in reality, they are regular documents, just with a special ID). The IDs of design documents must begin with ''_design/'' and have a special views attribute that have a ''map'' member and an optional ''reduce'' member to hold the view functions. All the views in one design document are indexed whenever any of them gets queried. - - A design document that defines ''all'', ''by_lastname'', and ''total_purchases'' views might look like this: - - {{{#!highlight javascript - { - "_id":"_design/company", - "_rev":"12345", - "language": "javascript", - "views": - { - "all": { - "map": "function(doc) { if (doc.Type == 'customer') emit(null, doc) }" - }, - "by_lastname": { - "map": "function(doc) { if (doc.Type == 'customer') emit(doc.LastName, doc) }" - }, - "total_purchases": { - "map": "function(doc) { if (doc.Type == 'purchase') emit(doc.Customer, doc.Amount) }", - "reduce": "function(keys, values) { return sum(values) }" - } - } - } - }}} - The ''language'' property of the design document tells CouchDB the language of the functions inside it -- map, reduce, validate, show, list, etc. Based on this it selects the appropriate ViewServer (as specified in your couch.ini file). The default is to assume Javascript, so this property can be omitted for Javascript-based design documents. - - == Altering/Changing Views == - To change a view or multiple view just alter the design document (see HttpDocumentApi) they are stored in and save it as a new revision. This causes all the views in that design document to be rebuilt on the next access in case the view code has been changed. - - == Access/Query == - Once this document is saved into a database, then the ''all'' view can be retrieved at the URL: - - . http://localhost:5984/database/_design/company/_view/all - - Example: - - {{{ - GET /some_database/_design/company/_view/all HTTP/1.0 - Date: Thu, 17 Aug 2006 05:39:28 +GMT - }}} - And will result in the following response: - - {{{ - HTTP/1.1 200 OK - Date: Thu, 17 Aug 2006 05:39:28 +GMT - Content-Length: 318 - Connection: close - - { - "total_rows": 3, - "offset": 0, - "rows": [{ - "id":"64ACF01B05F53ACFEC48C062A5D01D89", - "key": null, - "value": { - "LastName":"Katz", - "FirstName":"Damien", - "Address":"2407 Sawyer drive, Charlotte NC", - "Phone":012555754211 - } - }, { - "id":"5D01D8964ACF01B05F53ACFEC48C062A", - "key": null, - "value": { - "LastName":"Kerr", - "FirstName":"Wayne", - "Address":"123 Fake st., such and such", - "Phone":88721320939 - } - }, { - "id":"EC48C062A5D01D8964ACF01B05F53ACF", - "key": null, - "value": - { - "LastName":"McCracken", - "FirstName":"Phil", - "Address":"1234 Fake st., such and such", - "Phone":7766552342 - } - } - ] - } - }}} - == View Generation Options == - There are two view indexing options that can be defined in a design document as boolean properties of an 'options' sub-object. (Unlike the querying options below, these aren't URL parameters because they take effect when the view index is ''generated'', not when it's ''accessed''.) - - {{{#!highlight javascript - "options" : { - "local_seq" : true, - "include_design" : true - } - }}} - - '''local_seq''' makes documents' local sequence numbers available to map functions (as a '_local_seq' document property). - - '''include_design''' causes map functions to be called on design documents as well as regular documents. - - == Querying Options == - Columns can be a list of values, there is no set limit to the number of values or amount of data that columns can hold. - - The following URL query arguments for '''GET/HEAD''' requests are allowed: - ||'''Parameter''' ||'''Value'''
[Couchdb Wiki] Update of "HTTP_Bulk_Document_API" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HTTP_Bulk_Document_API" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HTTP_Bulk_Document_API?action=diff=25=26 Comment: migrated - <> - = HTTP Bulk Document API = - - See also the official documentation for the [[http://docs.couchdb.org/en/latest/api/database.html#get-db-all-docs|read]] and [[http://docs.couchdb.org/en/latest/api/database.html#post-db-bulk-docs|write]] portions of this topic. - - < > - - == Fetch Multiple Documents With a Single Request == - {{{_all_docs}}} implements the [[HTTP_view_API]] where each ''key'' is the doc _id, and each ''value'' is a JSON object containing the rev. This means that: - - * By adding {{{?include_docs=true}}} you can get the documents themselves, not just their id and rev - * By adding {{{?startkey="xx"="yy"}}} you can get the documents with keys in a certain range - * By POSTing to _all_docs you can get a set of documents with arbitrary keys - - Simple example to fetch the keys {{{bar}}} and {{{baz}}} and include the complete document in the result set: - - {{{ - curl -d '{"keys":["bar","baz"]}' -X POST http://127.0.0.1:5984/foo/_all_docs?include_docs=true - }}} - Result: - - {{{#!highlight javascript - {"total_rows":3,"offset":0,"rows":[ - {"id":"bar","key":"bar","value":{"rev":"1-4057566831"},"doc":{"_id":"bar","_rev":"1-4057566831","name":"jim"}}, - {"id":"baz","key":"baz","value":{"rev":"1-2842770487"},"doc":{"_id":"baz","_rev":"1-2842770487","name":"trunky"}} - ]} - }}} - - * The rows are returned in the same order as the supplied "keys" array. - * The row for a deleted document will have the revision ID of the deletion, and an extra key "deleted":true in the "value" property. - * The row for a nonexistent document will just contain an "error" property with the value "not_found". - - Example with startkey and endkey ('''be aware''' of correct url encoding!): - - {{{ - curl 'http://127.0.0.1:5984/foo/_all_docs?include_docs=true="ba"="bb;' - }}} - Result: - - {{{#!highlight javascript - {"total_rows":3,"offset":0,"rows":[ - {"id":"bar","key":"bar","value":{"rev":"1-4057566831"},"doc":{"_id":"bar","_rev":"1-4057566831","name":"jim"}}, - {"id":"baz","key":"baz","value":{"rev":"1-2842770487"},"doc":{"_id":"baz","_rev":"1-2842770487","name":"trunky"}} - ]} - }}} - - == Modify Multiple Documents With a Single Request == - CouchDB provides a bulk insert/update feature. To use this, you make a ''POST'' request to the URI ''/{dbname}/_bulk_docs'', with the request body being a JSON document containing a list of new documents to be inserted or updated. - - For example (with curl): - - {{{ - $ DB="http://127.0.0.1:5984/mydb; - $ curl -d '{"docs":[{"key":"baz","name":"bazzel"},{"key":"bar","name":"barry"}]}' -X POST $DB/_bulk_docs - $ curl -d @your_file.json -X POST $DB/_bulk_docs - }}} - Doc formats below are as per CouchDB 0.9.x. - - {{{#!highlight javascript - { - "docs": [ - {"_id": "0", "integer": 0, "string": "0"}, - {"_id": "1", "integer": 1, "string": "1"}, - {"_id": "2", "integer": 2, "string": "2"} - ] - } - }}} - If you omit the per-document ''_id'' specification, CouchDB will generate unique IDs for you, as it does for regular ''POST'' requests to the database URI. - - The response to such a bulk request would look as follows (reformatted for clarity): - - {{{#!highlight javascript - [ - {"id":"0","rev":"1-62657917"}, - {"id":"1","rev":"1-2089673485"}, - {"id":"2","rev":"1-2063452834"} - ] - }}} - - The results are returned in the same order as the supplied "docs" array. - - Updating existing documents requires setting the ''_rev'' member to the revision being updated. To delete a document set the ''_deleted'' member to true. - - {{{#!highlight javascript - { - "docs": [ - {"_id": "0", "_rev": "1-62657917", "_deleted": true}, - {"_id": "1", "_rev": "1-2089673485", "integer": 2, "string": "2"}, - {"_id": "2", "_rev": "1-2063452834", "integer": 3, "string": "3"} - ] - } - }}} - Note that CouchDB will return in the response an id and revision for every document passed as content to a bulk insert, even for those that were just deleted. - - If the _rev does not match the current version of the document, then that particular document will ''not'' be saved and will be reported as a conflict, but this does not prevent other documents in the batch from being saved. - - {{{#!highlight javascript - [ - {"id":"0","error":"conflict","reason":"Document update conflict."}, - {"id":"1","rev":"2-1579510027"}, - {"id":"2","rev":"2-3978456339"} - ] - }}} - - Other possible values for ''error'' include ''forbidden'' (403) and ''unauthorized'' (401), both likely caused by a validation failure. - - If the ''new_edits=false'' query parameter is used in the request (to push existing revisions instead
[Couchdb Wiki] Update of "HTTP_status_list" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HTTP_status_list" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HTTP_status_list?action=diff=9=10 Comment: migrated - <> - A list of HTTP statuses used by CouchDB and their respective meanings. - - See also the [[http://docs.couchdb.org/en/latest/api-basics.html#http-status-codes|official documentation]] for this topic. - - === 200 - OK === - - Request completed successfully. - - === 201 - Created === - - Document created successfully. - - === 202 - Accepted === - - Request for database compaction completed successfully. - - === 304 - Not Modified === - - Etag not modified since last update. - - === 400 - Bad Request === - - Request given is not valid in some way. - - === 404 - Not Found === - - Such as a request via the HttpDocumentApi for a document which doesn't exist. - - === 405 - Resource Not Allowed === - - Request was accessing a non-existent URL. For example, if you have a malformed URL, or are using a third party library that is targeting a different version of CouchDB. - - === 409 - Conflict === - - Request resulted in an update conflict. - - === 412 - Precondition Failed === - - Request attempted to created database which already exists. - - === 500 - Internal Server Error === - - Request contained invalid JSON, probably happens in other cases too. - - ''As you can see, this document is incomplete, please update.'' -
[Couchdb Wiki] Update of "HttpGetRoot" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HttpGetRoot" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HttpGetRoot?action=diff=5=6 - <> - = HTTP GET root = - - ||'''Method'''||<-2>GET|| - ||'''Path'''||<-2>/|| - ||'''Query args'''||<-2>None|| - ||'''Request body'''||<-2>None|| - ||'''Response body'''||<-2>JSON object containing MOTD and CouchDB server version|| - - == Description == - - Returns MOTD and version. The MOTD can be specified in CouchDB configuration files. - - Starting in version 1.3.0, a server UUID is also returned. This UUID is generated once for every server. - - == Example == - {{{ - GET / HTTP/1.1 - }}}{{{ - HTTP/1.1 200 OK - Cache-Control: must-revalidate - - # Response from version 0.11.0: - {"couchdb":"Welcome","version":"0.11.0"} - # Response from version 1.3.0: - {"couchdb":"Welcome","uuid":"1234567890abcdedfghijklmnopq","version":"1.3.0","vendor":{"name":"The Apache Software Foundation","version":"1.3.0"}} - }}} -
[Couchdb Wiki] Update of "HttpPostRevsDiff" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HttpPostRevsDiff" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HttpPostRevsDiff?action=diff=2=3 Comment: migrated - <> - = HTTP POST _revs_diff = - - ||'''Method'''||<-2>POST|| - ||'''Path'''||<-2>/_revs_diff|| - ||'''Query args'''||<-2>None|| - ||'''Request body'''||<-2>JSON object whose keys are document IDs and values arrays of revision IDs|| - ||'''Response body'''||<-2>JSON object describing which revisions are not in the database|| - - == Description == - - Given a set of document/revision IDs, returns the subset of those that do ''not'' correspond to revisions stored in the database. - - Its primary use is by the replicator, as an important optimization: after receiving a set of new revision IDs from the source database, the replicator sends this set to the destination database's _revs_diff to find out which of them already exist there. It can then avoid fetching and sending already-known document bodies. - - Both the request and response bodies are JSON objects whose keys are document IDs; but the values are structured differently: - - * In the ''request'', a value is an array of revision IDs for that document. - * In the ''response'', a value is an object with a {{{"missing":}}} key, whose value is a list of revision IDs for that document (the ones that are not stored in the database) and optionally a {{{"possible_ancestors"}}} key, whose value is an array of revision IDs that ''are'' known that might be ancestors of the missing revisions. - - '''Disclaimer:''' This information was derived from mailing-list posts and experimentation and has not yet been reviewed by someone familiar with the implementation. --JensAlfke, Dec. 2011 - - == Example == - {{{ - POST /_revs_diff HTTP/1.1 - Content-Type: application/json - - {"03ee06461a12f3c288bb865b22000170": ["1-b2e54331db828310f3c772d6e042ac9c", "2-3a24009a9525bde9e4bfa8a99046b00d"], - "82e04f650661c9bdb88c57e044000a4b": ["3-bb39f8c740c6ffb8614c7031b46ac162"]} - }}}{{{ - HTTP/1.1 200 OK - Cache-Control: must-revalidate - - {"03ee06461a12f3c288bb865b22000170": {"missing": ["2-3a24009a9525bde9e4bfa8a99046b00d"]}} - }}} -
[Couchdb Wiki] Update of "HttpGetUuids" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HttpGetUuids" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HttpGetUuids?action=diff=9=10 Comment: migrated - <> - = HTTP GET _uuids = - - ||'''Method'''||<-2>GET|| - ||'''Path'''||<-2>/_uuids|| - ||'''Query args'''||count='''n'''||How many UUIDs to generate ''(optional, default '''1''')''|| - ||'''Request body'''||<-2>None|| - ||'''Response body'''||<-2>JSON object containing a list of generated UUIDs|| - - == Description == - - Returns a list of generated UUIDs. CouchDB generated UUIDs are of all lowercase strings of 32 characters; they do not conform to the UUID standard. They are obtained from through this API, and automatically used when using POST to add articles to a database, but are not otherwise used anywhere. There is no need to use the UUIDs generated by CouchDB for anything. The generated UUIDs are not checked for uniqueness. In the (very unlikely) case of where there is a duplicate, this is expected to be resolved when documents are inserted in to the database. - - CouchDB attempts to make sure that the results of this request are never cached by giving several cache-inhibiting headers in the response. - - CouchDB has three different UUID generation algorithms: - - * {{{random}}}: 32 hex characters generated completely at random. - - * {{{sequential}}}: 26 hex character random prefix, followed by 6 hex characters of sequence, which is incremented by random amounts. When the 6 character sequence overflows, a new random prefix is chosen. There are no guarantees of ordering, but most inserted documents will be sequentially ordered. This improves insert speed as most B-tree edits do not happen randomly. Also, if the documents are likely to be accessed sequentially, this improves access speeds. - - * {{{utc_random}}}: First 14 hex characters are microseconds since Jan 1, 1970 (Unix epoch), followed by 18 random hex characters. - - The UUID generation algorithm is specified in CouchDB configuration as {{{uuids/algorithm}}}. - - == Example == - {{{ - GET /_uuids HTTP/1.1 - }}}{{{ - HTTP/1.1 200 OK - Pragma: no-cache - Expires: Fri, 01 Jan 1990 00:00:00 GMT - ETag: "EWNHGXU29MRN49ZE792Z9Q466" - Cache-Control: must-revalidate, no-cache - - {"uuids":["0992c54b79c5f8c603947c67a2d2"]} - }}} -
[Couchdb Wiki] Update of "HttpGetFavicon" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HttpGetFavicon" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HttpGetFavicon?action=diff=2=3 Comment: migrated - <> - = HTTP GET favicon.ico = - - ||'''Method'''||<-2>GET|| - ||'''Path'''||<-2>/favicon.ico|| - ||'''Query args'''||<-2>None|| - ||'''Request body'''||<-2>None|| - ||'''Response body'''||<-2>Site icon|| - - == Description == - - Returns the favicon for the site. The favicon is a part of the admin interface, but the handler for it is special as CouchDB tries to make sure that the favicon is cached for one year. - - == Example == - {{{ - GET /favicon.ico HTTP/1.1 - }}}{{{ - HTTP/1.1 200 OK - Expires: Wed, 14 Sep 2011 01:16:39 GMT - Cache-Control: public, max-age=31536000 - Content-Type: image/x-icon - - - }}} -
[Couchdb Wiki] Update of "HttpGetAllDbs" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HttpGetAllDbs" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HttpGetAllDbs?action=diff=3=4 Comment: migrated - <> - = HTTP GET _all_dbs = - - ||'''Method'''||<-2>GET|| - ||'''Path'''||<-2>/_all_dbs|| - ||'''Query args'''||<-2>None|| - ||'''Request body'''||<-2>None|| - ||'''Response body'''||<-2>JSON array containing a list of all databases on server|| - - == Description == - - Returns a list of databases on this server. The returned database names are unescaped, and may contain characters that need to be properly escaped to be used as the database part in an URL. Most notably, databases in subdirectories contain one or more slashes in their names, and these must be escaped as {{{%2F}}} when used in URLs. - - == Example == - {{{ - GET /_all_dbs HTTP/1.1 - }}}{{{ - HTTP/1.1 200 OK - Cache-Control: must-revalidate - - ["foo","bar","baz"] - }}} -
[Couchdb Wiki] Update of "HttpGetActiveTasks" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HttpGetActiveTasks" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HttpGetActiveTasks?action=diff=7=8 Comment: migrated - <> - = HTTP GET _active_tasks = - - ||'''Method'''||<-2>GET|| - ||'''Path'''||<-2>/_active_tasks|| - ||'''Query args'''||<-2>None|| - ||'''Request body'''||<-2>None|| - ||'''Response body'''||<-2>JSON array containing objects describing currently active tasks|| - - == Description == - - Returns a list of running tasks. - - === Example === - {{{ - GET /_active_tasks HTTP/1.1 - }}}{{{ - HTTP/1.1 200 OK - Cache-Control: must-revalidate - - [{"type":"Database Compaction","task":"exampledb","status":"Copied 5001 of 14832 changes (33%)","pid":"<0.14557.22>"}] - }}} - - == Changes in CouchDB 1.2.0 == - - The 1.2.0 release offers a more granular active tasks output. Basically, each task can have different properties which are only meaningful for that particular task type. There are currently 4 active task types: "indexer", "replication", "database_compaction", and "view_compaction". - - === Example === - - {{{ - $ curl http://localhost:5984/_active_tasks - [ - { - "pid": "<0.242.0>", - "changes_done": 31209, - "database": "indexer_test_3", - "design_document": "_design/test", - "progress": 5, - "started_on": 1316228432, - "total_changes": 551201, - "type": "indexer", - "updated_on": 1316228461 - }, - { - "pid": "<0.1156.0>", - "database": "indexer_test_3", - "design_document": "_design/test", - "progress": 21, - "started_on": 1316229336, - "type": "view_compaction", - "updated_on": 1316229352 - }, - { - "pid": "<0.1303.0>", - "replication_id": "1447443f5d0837538c771c3af68518eb+create_target", - "checkpointed_source_seq": 17333, - "continuous": false, - "doc_write_failures": 0, - "docs_read": 17833, - "docs_written": 17833, - "missing_revisions_found": 17833, - "progress": 3, - "revisions_checked": 17833, - "source": "http://fdmanana.iriscouch.com/indexer_test/;, - "source_seq": 551202, - "started_on": 1316229471, - "target": "indexer_test", - "type": "replication", - "updated_on": 1316230082 - }, - { - "pid":"<0.19211.43>", - "changes_done":4108, - "database":"compaction_test", - "progress":26, - "started_on":1344535100, - "total_changes":15344, - "type":"database_compaction", - "updated_on":1344535102 - } - ] - }}} - - The '''progress''' field is an integer in the range 0 to 100. The values for the fields '''started_on''' and '''updated_on''' corresponds to unix timestamps. -
[Couchdb Wiki] Update of "HttpGetLog" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HttpGetLog" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HttpGetLog?action=diff=6=7 Comment: migrated - <> - = HTTP GET _log = - - ||'''Method'''||<-2>GET|| - ||'''Path'''||<-2>/_log|| - ||'''Query args'''||bytes='''n'''||How many bytes to return from the tail of the log file''(optional, default '''1000''')''|| - || ||offset='''n'''||How many bytes to offset the returned tail of the log file ''(optional, default '''0''')''|| - ||'''Request body'''||<-2>None|| - ||'''Response body'''||<-2>Text from the couchdb log file|| - - == Description == - - Returns the tail of the server's log file. The {{{bytes}}} argument controls how many bytes to return from the end of the log file. As of 1.0.1, the offset argument is broken and does nothing useful. Also, since the log file is constantly appended to, the offset argument is not useful in attempting to iterate through the entire log file in chunks. - - This method requires server admin privileges. - - == Example == - {{{ - GET /_log HTTP/1.1 - }}}{{{ - HTTP/1.1 200 OK - - [Tue, 14 Sep 2010 00:28:28 GMT] [info] [<0.20318.14>] 127.0.0.1 - - 'GET' /_log 200 - - }}} -
[Couchdb Wiki] Update of "HTTP_Document_API" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HTTP_Document_API" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HTTP_Document_API?action=diff=96=97 Comment: migrated - <> - = HTTP Document API = - - See also the [[http://docs.couchdb.org/en/latest/api/documents.html|official documentation]] for this topic. - - < > - - This is an introduction to the CouchDB HTTP document API. - - == Naming/Addressing == - Documents stored in a CouchDB have a DocID. DocIDs are case-sensitive string identifiers that uniquely identify a document. Two documents cannot have the same identifier in the same database, they are considered the same document. - - {{{ - http://localhost:5984/test/some_doc_id - http://localhost:5984/test/another_doc_id - http://localhost:5984/test/BA1F48C5418E4E68E5183D5BD1F06476 - }}} - The above URLs point to ''some_doc_id'', ''another_doc_id'' and ''BA1F48C5418E4E68E5183D5BD1F06476'' in the database ''test''. - - == Documents == - A CouchDB document is simply a JSON object. You can use any JSON structure with nesting. You can fetch the document's revision information by adding ''?revs_info=true'' to the get request. - - Here are two simple examples of documents: - - {{{ - { - "_id":"discussion_tables", - "_rev":"D1C946B7", - "Sunrise":true, - "Sunset":false, - "FullHours":[1,2,3,4,5,6,7,8,9,10], - "Activities": [ -{"Name":"Football", "Duration":2, "DurationUnit":"Hours"}, -{"Name":"Breakfast", "Duration":40, "DurationUnit":"Minutes", "Attendees":["Jan", "Damien", "Laura", "Gwendolyn", "Roseanna"]} - ] - } - }}} - {{{ - { - "_id":"some_doc_id", - "_rev":"D1C946B7", - "Subject":"I like Plankton", - "Author":"Rusty", - "PostedDate":"2006-08-15T17:30:12-04:00", - "Tags":["plankton", "baseball", "decisions"], - "Body":"I decided today that I don't like baseball. I like plankton." - } - }}} - === Special Fields === - Note that any top-level fields within a JSON document containing a name that starts with a ''_'' prefix are reserved for use by CouchDB itself. Also see [[Reserved_words]]. Currently (0.10+) reserved fields are: - ||'''Field Name''' ||'''Description''' || - ||''_id'' ||The unique identifier of the document ('''mandatory''' and '''immutable''') || - ||''_rev'' ||The current MVCC-token/revision of this document ('''mandatory''' and '''immutable''') || - ||''_attachments'' ||If the document has attachments, _attachments holds a (meta-)data structure (see section on [[HTTP_Document_API#Attachments]]) || - ||''_deleted'' ||Indicates that this document has been deleted and previous revisions will be removed on next compaction run || - ||''_revisions'' ||Revision history of the document || - ||''_revs_info'' ||A list of revisions of the document, and their availability || - ||''_conflicts'' ||Information about conflicts || - ||''_deleted_conflicts'' ||Information about conflicts || - ||''_local_seq'' ||Sequence number of the revision in the database (as found in the _changes feed) || - - - - To request a special field be returned along with the normal fields you get when you request a document, add the desired field as a query parameter without the leading underscore in a GET request: - - {{{ - curl -X GET 'http://localhost:5984/my_database/my_document?conflicts=true' - }}} - This request will return a document that includes the special field '_conflicts' which contains all the conflicting revisions of "my_document". - - ['''Exception:''' The query parameter for the ''_revisions'' special field is 'revs', not 'revisions'.] - - Document IDs - Document IDs don't have restrictions on what characters can be used. Although it should work, it is recommended to use non-special characters for document IDs. Using special characters you have to be aware of proper URL en-/decoding. Documents prefixed with ''_'' are special documents: - ||'''Document ID prefix''' ||'''Description''' || - ||''_design/'' ||are DesignDocuments || - ||''_local/'' ||are not being replicated (local documents) and used for [[Replication]] checkpointing. || - - - - - You can have '''/''' as part of the document ID but if you refer to a document in a URL you must always encode it as '''%2F'''. One special case is '''_design/''' documents, those accept either '''/''' or '''%2F''' for the '''/''' after ''_design'', although '''/''' is preferred and '''%2F''' is still needed for the rest of the DocID. - - == Working With Documents Over HTTP == - === GET === - To retrieve a document, simply perform a ''GET'' operation at the document's URL: - - {{{ - GET /somedatabase/some_doc_id HTTP/1.0 - }}} - Here is the server's response: - - {{{ - HTTP/1.1 200 OK - Etag: "946B7D1C" - Date: Thu, 17 Aug 2006 05:39:28 +GMT - Content-Type: application/json - Content-Length: 256 - Connection: close - - { - "_id":"some_doc_id", - "_rev":"946B7D1C", -
[Couchdb Wiki] Update of "HTTP_database_API" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "HTTP_database_API" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/HTTP_database_API?action=diff=37=38 Comment: migrated - <> - = HTTP Database API = - - See also the [[http://docs.couchdb.org/en/latest/api/database.html|official documentation]] for this topic. - - < > - - An introduction to the CouchDB HTTP Database API. - - == Naming and Addressing == - - A database must be named with all lowercase letters (a-z), digits (0-9), or any of the ''_$()+-/'' characters and must end with a slash in the URL. The name has to start with a lowercase letter (a-z). - - {{{ - http://couchserver/databasename/ - http://couchserver/another/databasename/ - http://couchserver/another/database_name(1)/ - }}} - - ''Uppercase characters are NOT ALLOWED in database names.'' - - {{{ - http://couchserver/DBNAME/ (invalid) - http://couchserver/DatabaseName/ (invalid) - http://couchserver/databaseName/ (invalid) - }}} - - Note also that a ''/'' character in a DB name must be escaped when used in a URL; if your DB is named ''his/her'' then it will be available at ''http://localhost:5984/his%2Fher''. - - ''Rationale for character restrictions'' - - The limited set of characters for database names is driven by the need to satisfy the lowest common denominator for file system naming conventions. For example, disallowing uppercase characters makes compliance with case insensitive file systems straightforward. - - All database files are stored in a single directory on the file system. If your database includes a ''/'' CouchDB will create a sub-directory structure in the database directory. That is, a database named ''his/her'', the database file will be available at ''$dbdir/his/her.couch''. This is useful when you have a large number of databases and your file system does not like that. - - == Working with Databases == - - === List Databases === - - To get a list of databases on a CouchDB server, use the ''/_all_dbs'' URI: - - {{{ - GET /_all_dbs HTTP/1.1 - Date: Thu, 17 Aug 2006 05:39:28 +GMT - }}} - - And the response: - - {{{ - HTTP/1.1 200 OK - Date: Thu, 17 Aug 2006 05:39:28 +GMT - Content-Length: 37 - Content-Type: application/json - Connection: close - - ["somedatabase", "anotherdatabase"] - }}} - - === PUT (Create New Database) === - - To create a new empty database, perform a PUT operation at the database URL. Currently the content of the actual PUT is ignored by the webserver. - - On success, HTTP status ''201'' is returned. If a database already exists a ''412'' error is returned. - - {{{ - PUT /somedatabase/ HTTP/1.1 - Content-Length: 0 - Date: Thu, 17 Aug 2006 05:39:28 +GMT - }}} - - Here is the server's response: - - {{{ - HTTP/1.1 201 Created - Date: Thu, 17 Aug 2006 05:39:28 +GMT - Content-Length: 13 - Content-Type: application/json - Connection: close - - {"ok": true} - }}} - - === DELETE === - - To delete a database, perform a DELETE operation at the database location. - - On success, HTTP status ''200'' is returned. If the database doesn't exist, a ''404'' error is returned. - - {{{ - DELETE /somedatabase/ HTTP/1.1 - Content-Length: 1 - Date: Thu, 17 Aug 2006 05:39:28 +GMT - }}} - - Here is the server's response: - - {{{ - HTTP/1.1 200 OK - Date: Thu, 17 Aug 2006 05:39:28 +GMT - Content-Length: 67 - Content-Type: application/json - Connection: close - - {"ok": true} - }}} - - === Database Information === - - To get information about a particular database, perform a GET operation on the database, e.g.: - - {{{ - GET /somedatabase/ HTTP/1.1 - }}} - - The server's response is a JSON object similar to the following: - - {{{#!highlight javascript - { - "compact_running": false, - "db_name": "dj", - "disk_format_version": 5, - "disk_size": 12377, - "doc_count": 1, - "doc_del_count": 1, - "instance_start_time": "1267612389906234", - "purge_seq": 0, - "update_seq": 4 - } - }}} - - Meaning of Result Hash - - ||'''Key'''||'''Description'''|| - ||''db_name''||Name of the database (string)|| - ||''doc_count''||Number of documents (including design documents) in the database (int)|| - ||''update_seq''||Current number of updates to the database (int)|| - ||''purge_seq''||Number of purge operations (int)|| - ||''compact_running''||Indicates, if a compaction is running (boolean)|| - ||''disk_size''||Current size in Bytes of the database ('''Note''': Size of views indexes on disk are not included)|| - ||''instance_start_time''|| The time at which the database was opened (in μs) || - ||''disk_format_version''|| Current version of the internal database format on disk (int)|| - - === Accessing Database-specific options === - Currently there is only one database specific option you can set via a PUT request. ''_revs_limit'' defines a
[Couchdb Wiki] Update of "InstallationSurOpenSolarisEtJoynetAccellerator" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "InstallationSurOpenSolarisEtJoynetAccellerator" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/InstallationSurOpenSolarisEtJoynetAccellerator?action=diff=2=3 - #language fr - Allez sur http://wiki.joyent.com/accelerators:setup-couchdb pour les instructions d'installation. -
[Couchdb Wiki] Update of "InstallationSurRhel4" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "InstallationSurRhel4" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/InstallationSurRhel4?action=diff=2=3 - #language fr - Installation sur RHEL4 x86_64 - - 1. Installez Erlang - {{{ - wget http://www.erlang.org/download/otp_src_R12B-2.tar.gz - tar xzvf otp_src_R12B-2.tar.gz - cd otp_src_R12B-2 - ./configure && make && sudo make install - cd .. - }}} - 2. Installez les autres dépendances. Vous aurez besoin de EPEL et/ou RPMForge - {{{ - yum install icu libicu-devel js js-devel - }}} - 3. Installez SpiderMonkey ( optionnel si vous avez récupéré js/js-devel au-dessus) - - Voir aussi [[InstallationSpiderMonkey]] - {{{ - wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz - tar xvzf js-1.7.0.tar.gz - cd js/src/ - make -f Makefile.ref # (add BUILD_OPT=1 for non-debug build?) - JS_DIST=/usr/local/spidermonkey make -f Makefile.ref export - cd .. - cd .. - }}} - 4. Installez couchdb - {{{ - svn checkout http://svn.apache.org/repos/asf/incubator/couchdb/trunk couchdb - cd couchdb - ./bootstrap -C - ./configure --with-js-lib=/usr/local/spidermonkey/lib64 --with-js-include=/usr/local/spidermonkey/include - make && make install - }}} -
[Couchdb Wiki] Update of "Ido Ran" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Ido Ran" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Ido%20Ran?action=diff=2=3 - ##master-page:HomepageTemplate - #format wiki - #language en - == Ido Ran == - Email: <> - - My name is Ido Ran. I'm a human and a developer (in that order :) ) - I've develop a lot of code until I learn to code right. - Please see my latest library which is Object-Document-Mapper for [[couchdb.apache.org|CouchDB]] call [[github.com/ido-ran/CouchPotato|CouchPotato]] - - CategoryHomepage -
[Couchdb Wiki] Update of "InstallationSurSlackware" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "InstallationSurSlackware" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/InstallationSurSlackware?action=diff=1=2 - == Dépendances de CouchDB == - Dans un premier temps, il vous faut récupérer les slackbuilds suivants : - - * [[http://slackbuilds.org/repository/13.0/network/js/|js]] - * [[http://slackbuilds.org/repository/13.0/libraries/icu4c/|icu4c]] - * [[http://slackbuilds.org/repository/13.0/development/erlang-otp/|erlang-otp]] - - Les [[http://books.couchdb.org/relax/appendix/installing-from-source|autres dépendances]] sont normalement satisfaites : - * curl : à vérifier en utilisant un : - {{{#!bash - curl-config --version - }}} - * make & gcc - - Créer les packages des slackbuids (les slackbuils sont prévus pour i486 ; si vous êtes en 64 bits, éditer le fichier `.Slackbuild` pour modifier la valeur de `ARCH`. - - Pour que le SlackBuild fonctionne, il vous faut mettre l'archive des sources du package à créer dans le répertoire créé en décompressant le fichier slackbuild. - - {{{#!bash - tar xzf js.tar.gz - cd js - ./js.SlackBuild - => Slackware package /tmp/js-1.8.0_rc1-x86_64-1_SBo.tgz created. - - tar xzf icu4c.tar.gz - cd ../icu4c - ./icu4c.SlackBuild - => Slackware package /tmp/icu4c-4.2.1-x86_64-1_SBo.tgz created - - tar xzf erlang-otp.tar.gz - cd erlang-otp - ./erlang-otp.SlackBuild - => Slackware package /tmp/erlang-otp-13B03-x86_64-1_SBo.tgz created. - }}} - - Installer ensuite les packages créés : - - {{{#!bash - nicolas@cassis:/tmp$ sudo installpkg icu4c-4.2.1-x86_64-1_SBo.tgz - Verifying package icu4c-4.2.1-x86_64-1_SBo.tgz. - Installing package icu4c-4.2.1-x86_64-1_SBo.tgz: - PACKAGE DESCRIPTION: - # icu4c (International Components for Unicode) - # - # The International Components for Unicode (ICU) libraries provide - # robust and full-featured Unicode services on a wide variety of - # platforms. - # - # Homepage: http://www.icu-project.org/ - # - Executing install script for icu4c-4.2.1-x86_64-1_SBo.tgz. - Package icu4c-4.2.1-x86_64-1_SBo.tgz installed. - - nicolas@cassis:/tmp$ sudo installpkg js-1.8.0_rc1-x86_64-1_SBo.tgz - Verifying package js-1.8.0_rc1-x86_64-1_SBo.tgz. - Installing package js-1.8.0_rc1-x86_64-1_SBo.tgz: - PACKAGE DESCRIPTION: - # SpiderMonkey (Mozilla's JavaScript Engine) - # - # SpiderMonkey is the code-name for the Mozilla's C implementation of - # JavaScript. It can be used by applications such as elinks and others. - # - # This is the standalone version of the engine used by Firefox and other - # Mozilla applications. - # - # Homepage: http://www.mozilla.org/js/spidermonkey - # - Package js-1.8.0_rc1-x86_64-1_SBo.tgz installed. - - nicolas@cassis:/tmp$ sudo installpkg erlang-otp-13B03-x86_64-1_SBo.tgz - Verifying package erlang-otp-13B03-x86_64-1_SBo.tgz. - Installing package erlang-otp-13B03-x86_64-1_SBo.tgz: - PACKAGE DESCRIPTION: - # Erlang (programming language) - # - # Erlang is a general-purpose concurrent programming language and - # runtime system. - # The sequential subset of Erlang is a functional language, - # with strict evaluation, single assignment, and dynamic typing. - # It was designed by Ericsson to support distributed, - # fault-tolerant, soft-real-time, non-stop applications. - # - # http://www.erlang.org/ - # - Executing install script for erlang-otp-13B03-x86_64-1_SBo.tgz. - Package erlang-otp-13B03-x86_64-1_SBo.tgz installed. - }}} - - == Installation de CouchDB == - - Il vous faut au préalable créer un utilisateur et un groupe couchdb : - - {{{#!bash - groupadd -g 231 couchdb - useradd -u 231 -g couchdb -d /var/lib/couchdb -s /bin/sh couchdb - }}} - - Récupérer le [[http://slackbuilds.org/repository/13.0/development/couchdb/|slackbuild de CouchDB]] - - il vous faut alors procéder de la façon suivante : - - {{{#!bash - tar xzf couchdb.tar.gz - cd couchdb - # récupérer les sources de couchdb 0.10.1 et metter les dans votre répertoire couchdb - # éditer si besoin le SlackBuild - # créer votre package : - ./couchdb.Slackbuild - => Slackware package /tmp/SBo/couchdb-0.10.1-x86_64-1_SBo.tgz created. - }}} - - Il ne reste plus qu'à installer le paquet : - - {{{#!bash - installpkg /tmp/SBo/couchdb-0.10.1-x86_64-1_SBo.tgz - }}} - - == Démarrage / Arrêt automatique de CouchDB == - - Editer /etc/rc.d/rc.local pour y ajouter : - - {{{#!bash - if [ -x /etc/rc.d/rc.couchdb ]; then - . /etc/rc.d/rc.couchdb start - fi - }}} - - et dans /etc/rc.d/rc.local_shutdown : - - {{{#!bash - if [
[Couchdb Wiki] Update of "InstallationSurFedora7" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "InstallationSurFedora7" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/InstallationSurFedora7?action=diff=3=4 - #language fr - Installation sur Fedora Core 7 i386 - 1. Installez Erlang - {{{ - yum install erlang - }}} - 2. Installez les autres dépendances (aucune source de paquet indépendante requise) - {{{ - yum install icu libicu-devel js js-devel - }}} - 3. Installez Couchdb - {{{ - svn checkout http://svn.apache.org/repos/asf/incubator/couchdb/trunk couchdb - cd couchdb - ./bootstrap -C - ./configure - make && make install - }}} - 4. Créez l'utilisateur couchdb - {{{ - sudo adduser -r -d /usr/local/var/lib/couchdb couchdb - sudo chown -R couchdb /usr/local/var/lib/couchdb - sudo chown -R couchdb /usr/local/var/log/couchdb - }}} - 5. (optionnel) éditez les préférences Port et !BindAddress - {{{ - vim /usr/local/etc/couchdb/couch.ini - }}} - 6. Démarrez le serveur CouchDB dans votre terminal - {{{ - sudo -u couchdb couchdb - }}} - ou comme démon - {{{ - sudo /usr/local/etc/rc.d/couchdb start - }}} - - Allez sur http://localhost:5984/_utils/index.html - ou http://hostname:5984/_utils/index.html si vous avez modifié !BindAddress -
[Couchdb Wiki] Update of "InstallationSurRhel5" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "InstallationSurRhel5" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/InstallationSurRhel5?action=diff=4=5 - #language fr - ## page was renamed from InstallattionSurRhel5 - Installation sur RHEL5 x86_64 - - 1. Installez les dépendances. Vous pouvez avoir besoin de EPEL/RPMFORGE - - {{{ - yum install ncurses-devel openssl-devel icu libicu-devel js js-devel - }}} - - 2. Installez Erlang - {{{ - wget http://www.erlang.org/download/otp_src_R12B-2.tar.gz - tar xzvf otp_src_R12B-2.tar.gz - cd otp_src_R12B-2 - ./configure && make && sudo make install - cd .. - }}} - - 3. Installez Couchdb - {{{ - svn checkout http://svn.apache.org/repos/asf/incubator/couchdb/trunk couchdb - cd couchdb - ./bootstrap - ./configure && make && make install - }}} - - 4. Editez le fichier de configuration : - - {{{ - vi /usr/local/etc/couchdb/couch.ini - }}} - - 5. Créez l'utilisateur, et appliquez les permissions sur les dossiers - {{{ - adduser -r -d /usr/local/var/lib/couchdb couchdb - chown -R couchdb /usr/local/var/lib/couchdb - chown -R couchdb /usr/local/var/log/couchdb - }}} - - 6. Lancez! En console : - {{{ - sudo -u couchdb couchdb - }}} - ou comme démon : - {{{ - sudo /usr/local/etc/rc.d/couchdb start - }}} -
[Couchdb Wiki] Update of "InstallationSurWindows" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "InstallationSurWindows" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/InstallationSurWindows?action=diff=2=3 - #language fr - CouchDB ne s'installe pas nativement sur Windows mais il est possible de l'installer à la main. - - Merci de mettre à jour ce guide si nécessaire, nous souhaitons récupérer votre retour d'expérience afin de l'intégrer dans la procedédure d'installation officielle. - - - == Dépendances == - - Vous avez besoin des logiciels suivants installés sur votre système : - - * [[http://www.erlang.org/download.html|Erlang/OTP]] - * C Compiler/Linker (such as [[http://gcc.gnu.org/|GCC]] or [[http://msdn.microsoft.com/en-us/visualc/default.aspx|Visual C++]]) - * Make (such as [[http://www.gnu.org/software/make/|GNU Make]] or [[http://msdn.microsoft.com/en-us/library/dd9y37ha(VS.71).aspx|nmake]]) - * [[http://www.openssl.org/|OpenSSL]] - * [[http://www.icu-project.org/|ICU]] - * [[http://www.mozilla.org/js/spidermonkey/|SpiderMonkey]] - - == Installation de base == - - Après avoir installé Erlang vous devez obtenir quelque chose de similaire à : - - {{{ - C:\Program Files\erl5.6.3 - }}} - - Copiez l'arborescence complète du source de Couchdb ici : - - {{{ - C:\Program Files\erl5.6.3\lib\couchdb-0.8.0 - }}} - - Créeez le dossier vide suivant : - - {{{ - C:\Program Files\erl5.6.3\lib\mochiweb-0.01\ebin - }}} - - À partir de ICU copiez `icu*.dll` et `libeay32.dll` vers : - - {{{ - C:\Program Files\erl5.6.3\erts-5.6.2\bin - }}} - - De !SpiderMonkey copiez `js32.dll` et `jsshell.exe` vers : - - {{{ - C:\Program Files\erl5.6.3\erts-5.6.2\bin - }}} - - - == Compilation C == - - === couchdb/couch_erl_driver.c === - - C'est la couche qui fournit les fonctionnalités de ICU à CouchDB. - - Le plus simple pour compiler une DLL est de créer un projet Win32 DLL dans un IDE, ajoutez `couch_erl_driver.c` au projet, et changez les préférences du projet pour inclure les chemins de Erlang ERTS et des fichiers d'entêtes de ICU4C. - - Créez le dossier vide suivant : - - {{{ - C:\Program Files\erl5.6.3\lib\couchdb-0.8.0\priv - }}} - - Copiez la DDL vers : - - {{{ - C:\Program Files\erl5.6.3\lib\couchdb-0.8.0\priv\couch_erl_driver.dll - }}} - - === couchdb/couch_js.c === - - C'est la couche qui fournit UTF-8 et les améliorations cache à !SpiderMonkey. - - Remplacez js.c par couch_js.c, et changez '#include ' en '#include "jsapi.h"', ensuite compilez js.exe à nouveau, renommez le en couch_js.exe et copiez le vers : - - {{{ - C:\Program Files\erl5.6.3\erts-5.6.2\bin - }}} - - == Compilation Erlang == - - Créez le fichier suivant : - - {{{ - C:\Program Files\erl5.6.3\lib\couchdb-0.8.0\src\Emakefile - }}} - - Ajoutez le contenu suivant : - - {{{ - {'./couchdb/*', [{outdir,"../ebin"}]}. - {'./mochiweb/*', [{outdir,"../../mochiweb-0.01/ebin"}]}. - }}} - - Lançez `erl` (ou `werl`) et executez la commande suivante pour changer le dossier : - - {{{ - cd("C:/Program Files/erl5.6.3/lib/couchdb-0.8.0/src"). - }}} - - Exécutez cette commande pour compiler CouchDB : - - {{{ - make:all(). - }}} - - == Configuration == - Copiez le fichier suivant : - - {{{ - C:\Program Files\erl5.6.3\lib\couchdb-0.8.0\etc\couchdb\couch.ini.tpl.in - }}} - - ici : - - {{{ - C:/Program Files/erl5.6.3/bin/couch.ini - }}} - - Éditez ce fichier de la façon suivante : - - {{{ - [Couch] - - ConsoleStartupMsg=Apache CouchDB is starting. - - DbRootDir=C:/Path/To/Database/Directory - - Port=5984 - - BindAddress=127.0.0.1 - - DocumentRoot=C:/Program Files/erl5.6.3/lib/couchdb-0.8.0/share/www - - LogFile=C:/Path/To/Log/Directory - - UtilDriverDir=C:/Program Files/erl5.6.3/lib/couchdb-0.8.0/priv/couch_erl_driver.dll - - LogLevel=info - - [Couch Query Servers] - - javascript=couch_js "C:/Program Files/erl5.6.3/lib/couchdb-0.8.0/share/server/main.js" - }}} - - Make sure that the `DbRootDir` exists and that the `LogFile` can be created. - - == Exécution == - - Lançez `erl` (ou `werl`) et exécutez la commande suivante : - - {{{ - couch_server:start(). - }}} - - Pour voir si tout a fonctionné à ce point de l'installation, rendez-vous avec votre navigateur sur - [[http://localhost:5984/_utils/index.html]] et lançez `test suite`. -
[Couchdb Wiki] Update of "Introduction" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Introduction" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Introduction?action=diff=23=24 - The content of this page has moved to https://cwiki.apache.org/confluence/display/COUCHDB/Introduction
[couchdb] branch master updated: In _scheduler/docs fix `crashing` state showing as `pending` sometimes
This is an automated email from the ASF dual-hosted git repository. vatamane pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/couchdb.git The following commit(s) were added to refs/heads/master by this push: new b0f673f In _scheduler/docs fix `crashing` state showing as `pending` sometimes b0f673f is described below commit b0f673fb51bf521f96729499e939e29f0c58fe8c Author: Nick VatamaniucAuthorDate: Tue Apr 10 10:31:53 2018 -0400 In _scheduler/docs fix `crashing` state showing as `pending` sometimes Replication jobs are backed off based on the number of consecutive crashes, that is, we count the number of crashes in a row and then penalize jobs with an exponential wait based that number. After a job runs without crashing for 2 minutes, we consider it healthy and stop going back in its history and looking for crashes. Previously a job's state was set to `crashing` only if there were any consecutive errors. So it could have ran for 3 minutes, then user deletes the source database, job crashes and stops. Until it runs again the state would have been shown as `pending`. For internal accounting purposes that's correct but it is confusing for the user because the last event in its history is a crash. This commit makes sure that if the last even in job's history is a crash user will see the jobs as `crashing` with the respective crash reason. The scheduling algorithm didn't change. Fixes #1276 --- .../src/couch_replicator_scheduler.erl | 82 -- 1 file changed, 78 insertions(+), 4 deletions(-) diff --git a/src/couch_replicator/src/couch_replicator_scheduler.erl b/src/couch_replicator/src/couch_replicator_scheduler.erl index 0b39634..50896c5 100644 --- a/src/couch_replicator/src/couch_replicator_scheduler.erl +++ b/src/couch_replicator/src/couch_replicator_scheduler.erl @@ -138,11 +138,15 @@ job_summary(JobId, HealthThreshold) -> ErrorCount = consecutive_crashes(History, HealthThreshold), {State, Info} = case {Pid, ErrorCount} of {undefined, 0} -> -{pending, null}; +case History of +[{{crashed, Error}, _When} | _] -> +{crashing, crash_reason_json(Error)}; +[_ | _] -> +{pending, null} +end; {undefined, ErrorCount} when ErrorCount > 0 -> [{{crashed, Error}, _When} | _] = History, - ErrMsg = couch_replicator_utils:rep_error_to_binary(Error), - {crashing, ErrMsg}; + {crashing, crash_reason_json(Error)}; {Pid, ErrorCount} when is_pid(Pid) -> {running, null} end, @@ -1021,7 +1025,11 @@ scheduler_test_() -> t_oneshot_will_hog_the_scheduler(), t_if_excess_is_trimmed_rotation_doesnt_happen(), t_if_transient_job_crashes_it_gets_removed(), -t_if_permanent_job_crashes_it_stays_in_ets() +t_if_permanent_job_crashes_it_stays_in_ets(), +t_job_summary_running(), +t_job_summary_pending(), +t_job_summary_crashing_once(), +t_job_summary_crashing_many_times() ] }. @@ -1300,6 +1308,72 @@ t_if_permanent_job_crashes_it_stays_in_ets() -> end). +t_job_summary_running() -> +?_test(begin +Job = #job{ +id = job1, +pid = mock_pid(), +history = [added()], +rep = #rep{ +db_name = <<"db1">>, +source = <<"s">>, +target = <<"t">> +} +}, +setup_jobs([Job]), +Summary = job_summary(job1, ?DEFAULT_HEALTH_THRESHOLD_SEC), +?assertEqual(running, proplists:get_value(state, Summary)), +?assertEqual(null, proplists:get_value(info, Summary)), +?assertEqual(0, proplists:get_value(error_count, Summary)) +end). + + +t_job_summary_pending() -> +?_test(begin +Job = #job{ +id = job1, +pid = undefined, +history = [stopped(20), started(10), added()], +rep = #rep{source = <<"s">>, target = <<"t">>} +}, +setup_jobs([Job]), +Summary = job_summary(job1, ?DEFAULT_HEALTH_THRESHOLD_SEC), +?assertEqual(pending, proplists:get_value(state, Summary)), +?assertEqual(null, proplists:get_value(info, Summary)), +?assertEqual(0, proplists:get_value(error_count, Summary)) +end). + + +t_job_summary_crashing_once() -> +?_test(begin +Job = #job{ +id = job1, +history = [crashed(?DEFAULT_HEALTH_THRESHOLD_SEC + 1), started(0)], +rep = #rep{source = <<"s">>, target = <<"t">>} +},
[couchdb-documentation] branch master updated: Add nginx docs
This is an automated email from the ASF dual-hosted git repository. wohali pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/couchdb-documentation.git The following commit(s) were added to refs/heads/master by this push: new 68ba895 Add nginx docs 68ba895 is described below commit 68ba8951ec7ebc3a2c9933bde39eedfe54b4d8a2 Author: Joan TouzetAuthorDate: Thu Apr 12 13:26:09 2018 -0400 Add nginx docs --- src/best-practices/index.rst | 1 + src/best-practices/nginx.rst | 125 +++ 2 files changed, 126 insertions(+) diff --git a/src/best-practices/index.rst b/src/best-practices/index.rst index 0ea8c7a..362b3f1 100644 --- a/src/best-practices/index.rst +++ b/src/best-practices/index.rst @@ -26,3 +26,4 @@ system. forms jsdevel +nginx diff --git a/src/best-practices/nginx.rst b/src/best-practices/nginx.rst new file mode 100644 index 000..91d9885 --- /dev/null +++ b/src/best-practices/nginx.rst @@ -0,0 +1,125 @@ +.. Licensed under the Apache License, Version 2.0 (the "License"); you may not +.. use this file except in compliance with the License. You may obtain a copy of +.. the License at +.. +.. http://www.apache.org/licenses/LICENSE-2.0 +.. +.. Unless required by applicable law or agreed to in writing, software +.. distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +.. WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +.. License for the specific language governing permissions and limitations under +.. the License. + +.. _best-practices/nginx: + + +nginx as a Reverse Proxy + + +CouchDB recommends the use of `HAProxy`_ as a load balancer and reverse proxy. +The team's experience with using it in production has shown it to be superior +for configuration and montioring capabilities, as well as overall performance. + +CouchDB's sample haproxy configuration is present in the `code repository`_ and +release tarball as ``rel/haproxy.cfg``. + +However, ``nginx`` is a suitable alternative. Below are instructions on +configuring nginx appropriately. + +.. _HAProxy: http://haproxy.org/ +.. _code repository: https://github.com/apache/couchdb/blob/master/rel/haproxy.cfg + +Basic configuration +=== + +Here's a basic excerpt from an nginx config file in +``/sites-available/default``. This will proxy all +requests from ``http://domain.com/...`` to ``http://localhost:5984/...`` + +.. code-block:: text + +location / { +proxy_pass http://localhost:5984; +proxy_redirect off; +proxy_buffering off; +proxy_set_header Host $host; +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +} + +Proxy buffering **must** be disabled, or continuous replication will not +function correctly behind nginx. + +Reverse proxying CouchDB in a subdirectory with nginx += + +It can be useful to provide CouchDB as a subdirectory of your overall domain, +especially to avoid CORS concerns. Here's an excerpt of a basic nginx +configuration that proxies the URL ``http://domain.com/couchdb`` to +``http://localhost:5984`` so that requests appended to the subdirectory, such +as ``http://domain.com/couchdb/db1/doc1`` are proxied to +``http://localhost:5984/db1/doc1``. + +.. code-block:: text + +location /couchdb { +rewrite /couchdb/(.*) /$1 break; +proxy_pass http://localhost:5984; +proxy_redirect off; +proxy_buffering off; +proxy_set_header Host $host; +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +} + +Note that in the above configuration, the *Verify Installation* link in +Fauxton may not succeed. + +Authentication with nginx as a reverse proxy + + +Here's a sample config setting with basic authentication enabled, placing +CouchDB in the ``/couchdb`` subdirectory: + +.. code-block:: text + +location /couchdb { +auth_basic "Restricted"; +auth_basic_user_file htpasswd; +rewrite /couchdb/(.*) /$1 break; +proxy_pass http://localhost:5984; +proxy_redirect off; +proxy_buffering off; +proxy_set_header Host $host; +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +proxy_set_header Authorization ""; +} + +This setup leans entirely on nginx performing authorization, and forwarding +requests to CouchDB with no authentication (with CouchDB in Admin Party mode). +For a better solution, see :ref:`api/auth/proxy`. + +SSL with nginx +== + +In order to enable SSL, just enable the nginx SSL module, and add another +proxy header: + +.. code-block:: text + +ssl on; +ssl_certificate PATH_TO_YOUR_PUBLIC_KEY.pem; +ssl_certificate_key PATH_TO_YOUR_PRIVATE_KEY.key; +ssl_protocols SSLv3; +
[couchdb-documentation] branch nginx deleted (was 40d7c30)
This is an automated email from the ASF dual-hosted git repository. wohali pushed a change to branch nginx in repository https://gitbox.apache.org/repos/asf/couchdb-documentation.git. was 40d7c30 Add nginx docs The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository. -- To stop receiving notification emails like this one, please contact woh...@apache.org.
[couchdb-documentation] branch nginx updated (a6c1fbf -> 40d7c30)
This is an automated email from the ASF dual-hosted git repository. wohali pushed a change to branch nginx in repository https://gitbox.apache.org/repos/asf/couchdb-documentation.git. omit a6c1fbf Add nginx docs add 4389cf5 Bump curl earlier in intro, fix for Windows new 40d7c30 Add nginx docs This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (a6c1fbf) \ N -- N -- N refs/heads/nginx (40d7c30) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: src/intro/curl.rst | 20 src/intro/index.rst | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) -- To stop receiving notification emails like this one, please contact woh...@apache.org.
[couchdb-documentation] 01/01: Add nginx docs
This is an automated email from the ASF dual-hosted git repository. wohali pushed a commit to branch nginx in repository https://gitbox.apache.org/repos/asf/couchdb-documentation.git commit 40d7c30d97a13444755261e02bfac2accfbbcd95 Author: Joan TouzetAuthorDate: Thu Apr 12 13:26:09 2018 -0400 Add nginx docs --- src/best-practices/index.rst | 1 + src/best-practices/nginx.rst | 125 +++ 2 files changed, 126 insertions(+) diff --git a/src/best-practices/index.rst b/src/best-practices/index.rst index 0ea8c7a..362b3f1 100644 --- a/src/best-practices/index.rst +++ b/src/best-practices/index.rst @@ -26,3 +26,4 @@ system. forms jsdevel +nginx diff --git a/src/best-practices/nginx.rst b/src/best-practices/nginx.rst new file mode 100644 index 000..91d9885 --- /dev/null +++ b/src/best-practices/nginx.rst @@ -0,0 +1,125 @@ +.. Licensed under the Apache License, Version 2.0 (the "License"); you may not +.. use this file except in compliance with the License. You may obtain a copy of +.. the License at +.. +.. http://www.apache.org/licenses/LICENSE-2.0 +.. +.. Unless required by applicable law or agreed to in writing, software +.. distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +.. WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +.. License for the specific language governing permissions and limitations under +.. the License. + +.. _best-practices/nginx: + + +nginx as a Reverse Proxy + + +CouchDB recommends the use of `HAProxy`_ as a load balancer and reverse proxy. +The team's experience with using it in production has shown it to be superior +for configuration and montioring capabilities, as well as overall performance. + +CouchDB's sample haproxy configuration is present in the `code repository`_ and +release tarball as ``rel/haproxy.cfg``. + +However, ``nginx`` is a suitable alternative. Below are instructions on +configuring nginx appropriately. + +.. _HAProxy: http://haproxy.org/ +.. _code repository: https://github.com/apache/couchdb/blob/master/rel/haproxy.cfg + +Basic configuration +=== + +Here's a basic excerpt from an nginx config file in +``/sites-available/default``. This will proxy all +requests from ``http://domain.com/...`` to ``http://localhost:5984/...`` + +.. code-block:: text + +location / { +proxy_pass http://localhost:5984; +proxy_redirect off; +proxy_buffering off; +proxy_set_header Host $host; +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +} + +Proxy buffering **must** be disabled, or continuous replication will not +function correctly behind nginx. + +Reverse proxying CouchDB in a subdirectory with nginx += + +It can be useful to provide CouchDB as a subdirectory of your overall domain, +especially to avoid CORS concerns. Here's an excerpt of a basic nginx +configuration that proxies the URL ``http://domain.com/couchdb`` to +``http://localhost:5984`` so that requests appended to the subdirectory, such +as ``http://domain.com/couchdb/db1/doc1`` are proxied to +``http://localhost:5984/db1/doc1``. + +.. code-block:: text + +location /couchdb { +rewrite /couchdb/(.*) /$1 break; +proxy_pass http://localhost:5984; +proxy_redirect off; +proxy_buffering off; +proxy_set_header Host $host; +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +} + +Note that in the above configuration, the *Verify Installation* link in +Fauxton may not succeed. + +Authentication with nginx as a reverse proxy + + +Here's a sample config setting with basic authentication enabled, placing +CouchDB in the ``/couchdb`` subdirectory: + +.. code-block:: text + +location /couchdb { +auth_basic "Restricted"; +auth_basic_user_file htpasswd; +rewrite /couchdb/(.*) /$1 break; +proxy_pass http://localhost:5984; +proxy_redirect off; +proxy_buffering off; +proxy_set_header Host $host; +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +proxy_set_header Authorization ""; +} + +This setup leans entirely on nginx performing authorization, and forwarding +requests to CouchDB with no authentication (with CouchDB in Admin Party mode). +For a better solution, see :ref:`api/auth/proxy`. + +SSL with nginx +== + +In order to enable SSL, just enable the nginx SSL module, and add another +proxy header: + +.. code-block:: text + +ssl on; +ssl_certificate PATH_TO_YOUR_PUBLIC_KEY.pem; +ssl_certificate_key PATH_TO_YOUR_PRIVATE_KEY.key; +ssl_protocols SSLv3; +ssl_session_cache shared:SSL:1m; + +location / { +proxy_pass http://localhost:5984; +proxy_redirect off; +
[couchdb-documentation] 01/01: Add nginx docs
This is an automated email from the ASF dual-hosted git repository. wohali pushed a commit to branch nginx in repository https://gitbox.apache.org/repos/asf/couchdb-documentation.git commit a6c1fbfaf27c91d4aaebcf156ac6fa143a3bf238 Author: Joan TouzetAuthorDate: Thu Apr 12 13:26:09 2018 -0400 Add nginx docs --- src/best-practices/index.rst | 1 + src/best-practices/nginx.rst | 125 +++ 2 files changed, 126 insertions(+) diff --git a/src/best-practices/index.rst b/src/best-practices/index.rst index 0ea8c7a..362b3f1 100644 --- a/src/best-practices/index.rst +++ b/src/best-practices/index.rst @@ -26,3 +26,4 @@ system. forms jsdevel +nginx diff --git a/src/best-practices/nginx.rst b/src/best-practices/nginx.rst new file mode 100644 index 000..91d9885 --- /dev/null +++ b/src/best-practices/nginx.rst @@ -0,0 +1,125 @@ +.. Licensed under the Apache License, Version 2.0 (the "License"); you may not +.. use this file except in compliance with the License. You may obtain a copy of +.. the License at +.. +.. http://www.apache.org/licenses/LICENSE-2.0 +.. +.. Unless required by applicable law or agreed to in writing, software +.. distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +.. WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +.. License for the specific language governing permissions and limitations under +.. the License. + +.. _best-practices/nginx: + + +nginx as a Reverse Proxy + + +CouchDB recommends the use of `HAProxy`_ as a load balancer and reverse proxy. +The team's experience with using it in production has shown it to be superior +for configuration and montioring capabilities, as well as overall performance. + +CouchDB's sample haproxy configuration is present in the `code repository`_ and +release tarball as ``rel/haproxy.cfg``. + +However, ``nginx`` is a suitable alternative. Below are instructions on +configuring nginx appropriately. + +.. _HAProxy: http://haproxy.org/ +.. _code repository: https://github.com/apache/couchdb/blob/master/rel/haproxy.cfg + +Basic configuration +=== + +Here's a basic excerpt from an nginx config file in +``/sites-available/default``. This will proxy all +requests from ``http://domain.com/...`` to ``http://localhost:5984/...`` + +.. code-block:: text + +location / { +proxy_pass http://localhost:5984; +proxy_redirect off; +proxy_buffering off; +proxy_set_header Host $host; +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +} + +Proxy buffering **must** be disabled, or continuous replication will not +function correctly behind nginx. + +Reverse proxying CouchDB in a subdirectory with nginx += + +It can be useful to provide CouchDB as a subdirectory of your overall domain, +especially to avoid CORS concerns. Here's an excerpt of a basic nginx +configuration that proxies the URL ``http://domain.com/couchdb`` to +``http://localhost:5984`` so that requests appended to the subdirectory, such +as ``http://domain.com/couchdb/db1/doc1`` are proxied to +``http://localhost:5984/db1/doc1``. + +.. code-block:: text + +location /couchdb { +rewrite /couchdb/(.*) /$1 break; +proxy_pass http://localhost:5984; +proxy_redirect off; +proxy_buffering off; +proxy_set_header Host $host; +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +} + +Note that in the above configuration, the *Verify Installation* link in +Fauxton may not succeed. + +Authentication with nginx as a reverse proxy + + +Here's a sample config setting with basic authentication enabled, placing +CouchDB in the ``/couchdb`` subdirectory: + +.. code-block:: text + +location /couchdb { +auth_basic "Restricted"; +auth_basic_user_file htpasswd; +rewrite /couchdb/(.*) /$1 break; +proxy_pass http://localhost:5984; +proxy_redirect off; +proxy_buffering off; +proxy_set_header Host $host; +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +proxy_set_header Authorization ""; +} + +This setup leans entirely on nginx performing authorization, and forwarding +requests to CouchDB with no authentication (with CouchDB in Admin Party mode). +For a better solution, see :ref:`api/auth/proxy`. + +SSL with nginx +== + +In order to enable SSL, just enable the nginx SSL module, and add another +proxy header: + +.. code-block:: text + +ssl on; +ssl_certificate PATH_TO_YOUR_PUBLIC_KEY.pem; +ssl_certificate_key PATH_TO_YOUR_PRIVATE_KEY.key; +ssl_protocols SSLv3; +ssl_session_cache shared:SSL:1m; + +location / { +proxy_pass http://localhost:5984; +proxy_redirect off; +
[couchdb-documentation] branch nginx updated (bc1de63 -> a6c1fbf)
This is an automated email from the ASF dual-hosted git repository. wohali pushed a change to branch nginx in repository https://gitbox.apache.org/repos/asf/couchdb-documentation.git. omit bc1de63 Add nginx docs new a6c1fbf Add nginx docs This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (bc1de63) \ N -- N -- N refs/heads/nginx (a6c1fbf) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: src/best-practices/nginx.rst | 23 +++ 1 file changed, 7 insertions(+), 16 deletions(-) -- To stop receiving notification emails like this one, please contact woh...@apache.org.
[couchdb-documentation] branch master updated: Bump curl earlier in intro, fix for Windows
This is an automated email from the ASF dual-hosted git repository. wohali pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/couchdb-documentation.git The following commit(s) were added to refs/heads/master by this push: new 4389cf5 Bump curl earlier in intro, fix for Windows 4389cf5 is described below commit 4389cf55f6ad5abe0274894f0177a95f665630a2 Author: Joan TouzetAuthorDate: Thu Apr 12 11:02:52 2018 -0400 Bump curl earlier in intro, fix for Windows --- src/intro/curl.rst | 20 src/intro/index.rst | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/intro/curl.rst b/src/intro/curl.rst index 51907ed..c311830 100644 --- a/src/intro/curl.rst +++ b/src/intro/curl.rst @@ -51,6 +51,26 @@ clarity): shell> curl 'http://couchdb:5984/_uuids?count=5' +.. lint: ignore errors for the next 15 lines + +.. note:: +On Microsoft Windows, use double-quotes anywhere you see single-quotes in +the following examples. Use doubled double-quotes ("") anywhere you see +single quotes. For example, if you see: + +.. code-block:: bash + +shell> curl -X PUT 'http:/127.0.0.1:5984/demo/doc' -d '{"motto": "I love gnomes"}' + +you should replace it with: + +.. code-blocK:: bash + +shell> curl -X PUT "http://127.0.0.1:5984/demo/doc; -d "{""motto"": ""I love gnomes""}" + +If you prefer, ``^"`` and ``\"`` may be used to escape the double-quote +character in quoted strings instead. + You can explicitly set the HTTP command using the ``-X`` command line option. For example, when creating a database, you set the name of the database in the URL you send using a PUT request: diff --git a/src/intro/index.rst b/src/intro/index.rst index 681af9a..39e7116 100644 --- a/src/intro/index.rst +++ b/src/intro/index.rst @@ -46,7 +46,7 @@ teach how to use CouchDB. overview why consistency +curl tour api security -curl -- To stop receiving notification emails like this one, please contact woh...@apache.org.
[couchdb-documentation] branch windows-improvements-1 updated (4baaa39 -> a4c417f)
This is an automated email from the ASF dual-hosted git repository. wohali pushed a change to branch windows-improvements-1 in repository https://gitbox.apache.org/repos/asf/couchdb-documentation.git. omit 4baaa39 Bump curl earlier in intro, fix for Windows add a4c417f Bump curl earlier in intro, fix for Windows This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (4baaa39) \ N -- N -- N refs/heads/windows-improvements-1 (a4c417f) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: src/intro/curl.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To stop receiving notification emails like this one, please contact woh...@apache.org.
[Couchdb Wiki] Update of "JavascriptPatternViewCommonJs" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "JavascriptPatternViewCommonJs" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/JavascriptPatternViewCommonJs?action=diff=4=5 Comment: Migrated to http://docs.couchdb.org/en/2.1.1/query-server/javascript.html#commonjs-modules - <> - = Javascript Pattern to Share Code Between View and Other Functions = - - This works only if one is using CouchApp since this pattern is dependent on CouchApp directives. - - CouchApp directives are explained here: [[http://japhr.blogspot.com/2010/02/couchapp-templates-for-showing.html|Chris Strom's blog]]. - - == Shared Code == - - The following Javascript code fragment can be used as an example of a shared library between a View Map function and other functions (in this example, a validate_update_doc function). In the design document, create an entry under vendor.myComp.utils which is: - - {{{#!highlight javascript - var utils = { - -isArray: function(o) { - if( typeof(o) !== 'object' ) return false; - if( typeof(o.length) !== 'number' ) return false; - if( typeof(o.push) !== 'function' ) return false; - if( typeof(o.pop) !== 'function' ) return false; - if( typeof(o.concat) !== 'function' ) return false; - if( typeof(o.join) !== 'function' ) return false; - if( typeof(o.slice) !== 'function' ) return false; - if( typeof(o.reverse) !== 'function' ) return false; - if( typeof(o.splice) !== 'function' ) return false; - if( typeof(o.sort) !== 'function' ) return false; - - return true; -} - }; - - // CommonJS bindings - if( typeof(exports) === 'object' ) { -exports.isArray = utils.isArray; - }; - }}} - - Notes: - 1. In a couchApp (an application developed and deployed using CouchApp), the content above would be saved in a file named "vendor/myComp/utils.js". - 1. Files uploaded using CouchApp are stripped of their extensions since it would lead to confusion as the dot (period) is the natural Javascript separator. Therefore, the shared code is "known" by CouchApp as "vendor/myComp/utils.js" while it is referred internally to the design documents as "vendor.myComp.utils". - - == Inclusion using CommonJs == - - Using CommonJs, the library defined above (shared code) would be included in a "validate_update_doc" function as follows: - - {{{#!highlight javascript - function(newDoc, oldDoc, userCtxt) { - -var myUtils = require('vendor/myComp/utils'); - -// Verify geometries -if( newDoc.type === 'myDoc' ) { - - // Verify that list is an array - if( !myUtils.isArray(newDoc.list) ) { - throw( {forbidden: 'Invalid or missing list'} ); - } -} - } - }}} - - Notes: - 1. The 'require' function in CommonJs exposes the 'exports' defined in the library and assigns them to the variable. - 1. The variable 'myUtils' can be used to access the definitions from the shared code. - 1. Note that the path uses slashes and that the file extension (if using CouchApp) is omitted. - - == Inclusion using CouchApp directives == - - Since View Map and View Reduce functions do not have access to CommonJs, the way one can include shared code within those functions is to use CouchApp directives. More specifically, in CouchApp, the 'code' directive instructs the tool to include the content of another file (verbatim) at the location of the directive before uploading the file to CouchDb. - - An example of View Map function that shares the code defined above: - - {{{#!highlight javascript - function(doc) { - -// !code vendor/myComp/utils.js - -// Verify that list is an array -if( utils.isArray(doc.list) ) { - for(var i=0,e=doc.list.length; i
[Couchdb Wiki] Update of "JakubCzaplicki" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "JakubCzaplicki" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/JakubCzaplicki?action=diff=1=2 - #format wiki - #language en - == Jakub Czaplicki == - Twitter: http://twitter.com/kupsztal - - - CategoryHomepage -
[Couchdb Wiki] Update of "JensAlfke" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "JensAlfke" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/JensAlfke?action=diff=1=2 - ##master-page:HomepageTemplate - #format wiki - #language en - == Jens Alfke == - Email: <> or < > - ## You can even more obfuscate your email address by adding more uppercase letters followed by a leading and trailing blank. - - I work at Couchbase on the [[http://www.couchbase.com/products-and-services/couchbase-mobile|Couchbase Mobile for iOS]] product, a configuration of CouchDB that runs embedded in a native iPhone/iPad app. - - I've formerly worked at [[http://rockmelt.com|RockMelt]], Google and Apple. - - I'm also very interested in peer-to-peer networks, cryptography, identity, social software, and user interface design. - - I have a [[http://jens.mooseyard.com|blog]] that I don't update often enough. - - - CategoryHomepage -
[Couchdb Wiki] Update of "JonRoberts" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "JonRoberts" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/JonRoberts?action=diff=2=3 - ##master-page:HomepageTemplate - #format wiki - #language en - == Jon Roberts == - I work at SXSW in Austin, TX. We use CouchDB for things. - - Email: <> - ## You can even more obfuscate your email address by adding more uppercase letters followed by a leading and trailing blank. - - ... - - - CategoryHomepage -
[Couchdb Wiki] Update of "Known_Problems" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Known_Problems" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Known_Problems?action=diff=5=6 Comment: outdated - <> - This is a list of known issues and problems with couchdb - that may enlighten or clarify a bit which features are not 100% yet. - - This list is mainly targeted the would-be couchdb users that are researching and planning. Also - this list is probably not complete. - - === CouchDB 1.0.2 === - * Replication across WAN is unstable when dealing with larger datasets and will fail hard at some point (https://issues.apache.org/jira/browse/COUCHDB-690) - * Replication is NOT persistent. When you restart your couchdb server - you'll need to resend the replication setup. ('''Fixed in 1.1 through [[Replicator_DB|_replicator db]]''', see [[https://issues.apache.org/jira/browse/COUCHDB-776|COUCHDB-776]]) -
[Couchdb Wiki] Update of "Meeting20121010" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Meeting20121010" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Meeting20121010?action=diff=3=4 Comment: Outdated, nothing actionable...nothing memorable. If we had a full archive of meeting minutes, that would be one thing... - ## page was renamed from Meeting20121014 - <> - Meeting Minutes via -- DaveCottlehuber < > - - < > - - = Futon2 = - - * Broad consensus that we want to merge in @bigbluehat's [[https://github.com/bigbluehat/futon2|futon2]] but that futon2 should not be a blocker - * @mainerror & @eckoit are keen to help with futon2 - * @eckoit to tell us where futon2 is at in next meeting - - - = Doc Versions = - - What versions of documentation should we aim to provide? - - * Propose to provide from 1.3.0 onwards only - * Changes since 1.2.0 should be easy to separate / keep clean - * @dch to find a way to track which features were introduced in each release - * @dch to note who is working on what in documentation land - - = CouchApp Tool & Format = - - * @dch proposed to defer til after 1.3.0 on settling on a specific couchapp format and work on a consensus approach - * @eckoit and @chewbranca are keen to be involved in spearheading that with @benoitc - * Should we bundle [[https://github.com/benoitc/erica|erica]] @benoitc's erlang based couchapp tool? - - = CORS = - - * Everybody wants to see this in 1.3.0 - * @benoitc hopes to branch this in the next couple of days - - = 1.3.0 = - - * Docs, CORS, and bug fixes are on the list - * If you have blockers for 1.3.0 mark them as such in JIRA - * @wendall911 to coordinate packaging tests/integration for 1.3.0 - * @wendall911 to raise packaging a more recent erlang within .rpm/.deb files as part of packaging discussions - - * @mainerror & @wohali will help - * @dch to review open JIRAs for blockers - - = Test Suite = - - * @kocolosk and @benoitc to send summary of how tests are handled in bigcouch & refuge - * read up on [[http://learnyousomeerlang.com/common-test-for-uncommon-tests|Common Test]] - * Feels like a > 1.3.0 thing - * @wendall911 is interested in MOAR tests - - = Merge All the Forks = - - * Very small number of people who will be directly involved - * Great opportunity to expose the inner workings & design choices inside CouchDB - * Looking for suggestions on how the wider CouchDB dev group can assist this - * Consensus around build system is required, suggesting post 1.3.0 - * Nobody has yet disagreed to rebar wrapped in autotools, [[https://github.com/seth/rebar-tools|locked rebar deps]] may be useful - * @wendall911 and @wohali will consider this in packaging work - * @kocolosk to provide woolly update on how cloudant and bigcouch and couchdb fit together in the new world order - - = Admin = - - * 9pm Wednesday seems like a good time for those who made it (non sequitur of the century) - * @dch to send out proper timezone announcement for next meeting - * skip the bot and use @noe instead - - = Other Stuff = - - * @dch is setting up a "Learn to Hack on Erlang/CouchDB" group with @garrenmsith following from @wohali's efforts earlier this year - * @noe to organise a learnyou/hack/something @couchdb.apache.org list for that - * @janl notes everybody needs to spend 10 hours watching his [[http://www.youtube.com/watch?v=fdDmRLa6q1s|horse]] - - = IRC summary = - - {{{ - [2012/10/10 21:02] dch: I assume we have a quorum, so I suggest anybody who has a topic they want to cover just replies #topic - [2012/10/10 21:03] eckoit: #topic bundle erica - [2012/10/10 21:03] dch: #topic cors & docs - [2012/10/10 21:03] dch: #topic paperwork - how suitable is this time & date? - [2012/10/10 21:04] dch: #topic 1.3.0 priorities - [2012/10/10 21:04] eckoit: #topic default couchapp format - [2012/10/10 21:05] jan: #topic look at my horse - [2012/10/10 21:08] dch: #topic send out a proper timezone announcement, duly noted - [2012/10/10 21:09] dch: #topic doc versions - [2012/10/10 21:10] noe: #startmeeting - [2012/10/10 21:12] jan: #topic futon2 - [2012/10/10 21:12] noe: #startmeeting - [2012/10/10 21:12] dch: #startmeeting - [2012/10/10 21:14] noe: #chair bitdiddle davisp dch dch fdmanana jan JasonSmith jsonified kocolosk tilgovi - [2012/10/10 21:17] noe: #info dch indicates broad consensus that we want to merge in futon2 https://github.com/bigbluehat/futon2 - [2012/10/10 21:18] noe: #info jan wants us to kick off an exploratory work to see if this will work - [2012/10/10 21:19] noe: #action eckoit will talk to bigbluehat and find out current status of futon2 for next week - [2012/10/10 21:20] dch: #info mainerror eckoit put hands up for helping futon2 integration - [2012/10/10 21:20] noe: dch: i #action-ed that already :) - [2012/10/10 21:22] noe:
[Couchdb Wiki] Update of "ListeCodesHttp" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "ListeCodesHttp" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/ListeCodesHttp?action=diff=2=3 - Une liste des codes Http utilisés par CouchDB et leurs significations respectives. - - === 404 Not Found === - - Apparait lorsqu'un document n'existe pas à la suite d'une requête de ApiDocumentHttp. - - - ''Comme vous pouvez le voir, la liste est incomplète, merci de mettre à jour.''' -
[Couchdb Wiki] Update of "Link_Collection_Authentication_and_Authorization" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Link_Collection_Authentication_and_Authorization" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Link_Collection_Authentication_and_Authorization?action=diff=30=31 Comment: This is all realy out of date, almost everything proposed in here has been delivered. hooray - ## page was renamed from Authentication_and_Authorization - #format wiki - #language en - = Authentication and Authorization = - - == Disclaimer == - - These pages attempt to collect strands of thoughts that concern authentication and authorization in CouchDB. These pages do not describe the currently available support for authentication and authorization in CouchDB or any agreed implementation plans. - - == Discussion threads == - - The following discussions address authentication and authorization concerns: - - [[http://thread.gmane.org/gmane.comp.db.couchdb.devel/5325|2009-09-07]] Per-DB Auth Ideas and Proposal - - [[http://thread.gmane.org/gmane.comp.db.couchdb.devel/4099|2009-07-10]] : Cookie Auth - - [[http://thread.gmane.org/gmane.comp.db.couchdb.user/2980|2009-07-08]] : CouchDB shared hosting - - [[http://thread.gmane.org/gmane.comp.db.couchdb.devel/3792|2009-06-25]] : CouchDB Authentication and Authorization - - [[http://www.mail-archive.com/dev@couchdb.apache.org/msg02631.html|2009-04-29 : Baking Cookie-Based Authentication into CouchDB]] - - [[http://thread.gmane.org/gmane.comp.db.couchdb.user/2065|2009-04-20]] : Authentication and Authorisation for webmail project - - [[http://thread.gmane.org/gmane.comp.db.couchdb.user/1953|2009-04-12]] : auth using Nginx as proxy - - [[http://thread.gmane.org/gmane.comp.db.couchdb.user/1953|2009-04-10]] : security and validation API? - - [[http://thread.gmane.org/gmane.comp.db.couchdb.user/1488|2009-03-08]] : Proposal for digital signatures of documents (user@couchdb) - - [[http://thread.gmane.org/gmane.comp.db.couchdb.devel/1658|2008-11-21]] : New Security and Validation Features - - [[http://article.gmane.org/gmane.comp.db.couchdb.devel/1026|2008-07-02]] : Security and Validation - - [[http://article.gmane.org/gmane.comp.db.couchdb.devel/664|2008-04-28]] : CouchDB 1.0 work - - [[http://thread.gmane.org/gmane.comp.db.couchdb.devel/3031|2009-04-21]] : LDAP Authentication handler - - [[http://thread.gmane.org/gmane.comp.db.couchdb.devel/232|2008-01-09]] : The planned security model for CouchDB - - [[http://thread.gmane.org/gmane.comp.db.couchdb.devel/942|2008-06-16]] : How to contribute - especially authentication - - == JIRA issues == - - The following issues address authentication and authorization concerns: - - [[http://issues.apache.org/jira/browse/COUCHDB-34|COUCHDB-34]] : Enable replicator to use HTTP authentication. - - [[http://issues.apache.org/jira/browse/COUCHDB-263|COUCHDB-263]] : Require valid user for all database operations. - - [[http://issues.apache.org/jira/browse/COUCHDB-420|COUCHDB-420]] : OAuth authentication support (2-legged initially) and cookie-based authentication. - - [[https://issues.apache.org/jira/browse/COUCHDB-438|COUCHDB-438]] : Add per database (OAuth) authentication to couchdb - - [[http://issues.apache.org/jira/browse/COUCHDB-329|COUCHDB-329]] : Replication from Futon does not copy design docs with admin authentication. - - [[http://issues.apache.org/jira/browse/COUCHDB-256|COUCHDB-256]] : Replicating from a write-protected server fails - - [[http://issues.apache.org/jira/browse/COUCHDB-438|COUCHDB-438]] : Add per database (OAuth) authentication to couchdb - - [[http://issues.apache.org/jira/browse/COUCHDB-1238|COUCHDB-1238]] : CouchDB uses _users db for storing oauth credentials - - - == Definitions == - - Authentication:: any process by which you verify that someone is who they claim they are. - Authorization:: any process by which someone is allowed to be where they want to go, or to have information that they want to have. - - == References == - - [[Security_Features_Overview]] - - [[http://httpd.apache.org/docs/2.2/howto/auth.html|Apache 2.2 Authentication, Authorization and Access Control]] - - [[http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html|Apache Tomcat 6 Realms and AAA]] - - [[http://db.apache.org/derby/docs/10.5/ref/rrefproper13766.html|Apache Derby derby.authentication.provider]] - - [[http://tools.ietf.org/html/rfc2617|RFC 2617: HTTP Authentication: Basic and Digest Access Authentication]] - - [[http://db.apache.org/derby/docs/10.4/ref/rrefsqljgrant.html|Apache Derby GRANT Syntax]] - - [[http://db.apache.org/derby/docs/10.4/ref/rrefsistabssystableperms.html|Apache Derby SYSTABLEPERMS Table]] - - [[http://db.apache.org/derby/docs/10.4/ref/rrefsistabssyscolperms.html|Apache Derby SYSCOLPERMS Table]] - - [[http://www.kernel.org/pub/linux/libs/pam/|Pluggable Authentication Modules for Linux]] - -
[Couchdb Wiki] Update of "Lopezzz" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Lopezzz" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Lopezzz?action=diff=1=2 - #format wiki - #language en - == Lopezzz == - Lopezzz at hotmail dot com - - CategoryHomepage -
[Couchdb Wiki] Update of "MaxDocumentSize" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "MaxDocumentSize" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/MaxDocumentSize?action=diff=3=4 - The maximum request size to CouchDB is defined in src/mochiweb/mochiweb_request.erl - % Maximum recv_body() length of 1MB - -define(MAX_RECV_BODY, (1024*1024)). - - As this is the maximum request size, the maximum document size is less than 1MB. The maximum document size is not a constant value as the JSON encoding is variable on a per document basis and is best defined as MAX_RECV_BODY - the size of the JSON key and formatting data. - - You can edit MAX_RECV_BODY to a higher value. - - Note that this will either be a configuration option or there will be no limit to the document size in CouchDB 0.9 (that is currently in development) -
[Couchdb Wiki] Update of "MattAdams" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "MattAdams" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/MattAdams?action=diff=3=4 - #format wiki - #language en - == Matt Adams == - Founder of [[http://www.radicaldynamic.com|Radical Dynamic]]. - - Email: <> - - - CategoryHomepage -
[Couchdb Wiki] Update of "MarcelloBarnaba" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "MarcelloBarnaba" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/MarcelloBarnaba?action=diff=1=2 - ##master-page:HomepageTemplate - #format wiki - #language en - == Marcello Barnaba == - Hello! - - I am a computer nerd from Italy, currently living in Rome. - - I work with CouchDB at [[https://github.com/ifad|IFAD]], a specialized agency of the [[http://www.ifad.org|United Nations]]. Thanks to CouchDB and [[https://build.opensuse.org/package/show/home:vjt:ifad/couchdb-lucene|CouchDB-Lucene]] we've built a flexible workflow engine and document production system, that we're using in the organization to manage some of its internal processes. The net effect is increasing the efficiency and throughput of the organization, and also bringing Open Source Software where it's due :-). - - You can find me on social media outlets, a rough aggregator [[http://flavors.me/vjt|is here]], and I also badly maintain [[http://sindro.me|a personal blog]]. - - You can also contact me via e-mail at <>. - - CategoryHomepage -
[Couchdb Wiki] Update of "Mailing_lists" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Mailing_lists" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Mailing_lists?action=diff=3=4 - == Current Archives == - * [[http://mail-archives.apache.org/mod_mbox/couchdb-dev/|CouchDB developer]] - * [[http://mail-archives.apache.org/mod_mbox/couchdb-user/|CouchDB user]] - == Incubator Archives == - * [[http://mail-archives.apache.org/mod_mbox/incubator-couchdb-dev/|CouchDB developer]] - * [[http://mail-archives.apache.org/mod_mbox/incubator-couchdb-user/|CouchDB user]] -
[Couchdb Wiki] Update of "Merge_procedure" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Merge_procedure" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Merge_procedure?action=diff=1=2 - #redirect Merge_Procedure
[Couchdb Wiki] Update of "Mailing lists" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Mailing lists" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Mailing%20lists?action=diff=4=5 - The content of this page has moved to [[http://couchdb.apache.org/#mailing-lists|http://couchdb.apache.org/#mailing-lists]]
[Couchdb Wiki] Update of "Merge_Procedure" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Merge_Procedure" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Merge_Procedure?action=diff=17=18 Comment: We moved to a RTC model with master always releasable, in theory. - ## page was renamed from Merge_procedure - <> - = Introduction = - - A typical timeline might look like this: - - * Release 1.3 (June) - * Create the 1.4.x release branch (June) - * Merge feature A in to 1.4.x branch - * Merge feature B in to 1.4.x branch - * Merge feature C in to 1.4.x branch - * Release 1.4 - * Create 1.5.x release branch - * Merge bugfix 1 in to 1.4.x branch - * Merge bugfix 2 in to 1.4.x branch - * Merge bugfix 3 in to 1.4.x branch - * Release 1.4.1 - - Each one of these items is the responsibility of the Release Manager. - - The developers submit merge requests for completed work to the Release Manager. - - The Release Manager should follow this document when handling merge requests. - - Nothing should be committed to a release branch besides what goes through this process. - - If we all follow this, it will improve our code quality, test coverage, and documentation. - - = Feature Branches = - - Most work should happen in feature branches. - - If there is not already a ticket for your work, please[[https://issues.apache.org/jira/browse/COUCHDB | create one]]. - - == Naming == - - Please use the ticket number, the type of the branch, along with a very short descriptive phrase, for your branch name. - - If the ticket was COUCHDB-1234, and the ticket title was My Cool Feature, your branch should be called `1234-feature-cool`. If the issue is a bug and the branch includes the bug fix, it should be called `1234-fix-cool`. If `cool` are multiple words, separate them with a dash: `1234-feature-cool-stuff`. - - == Git Best Practice == - - Developers are free to use a feature branch in any way they see fit during development. Prior to submitting a merge request to dev@, though, the branch should be prepared according to the following rules, as the commits on the feature branch will be a permanent part of the couchdb project's history. - - A feature branch should consist of the smallest number of meaningful commits as possible. For bug fixes and small features, this is likely to be a single commit. For larger changes, multiple commits might be necessary. The guiding principle for deciding how many commits is coherence. A commit should be readable and, ideally, implement one distinct idea. A feature that requires multiple enhancements to achieve its goal should be presented as multiple commits. It is *not* necessary for the system to pass the test suite for any subset of these commits, only their combination. - - = Merge Request = - - The merge request is done by the developer wanting to add changes to a release branch. - - If you want to make a merge request, please follow these steps: - - * Prepare your code on a feature/bugfix branch. - - * Add any new tests that cover your code. - - * Add any new docs that cover your code. - - * Run `make distcheck` a few times and verify that it works reliably. - - * Send an email to [[http://mail-archives.apache.org/mod_mbox/couchdb-dev/|couchdb-dev]] mailing list. [[http://wiki.apache.org/couchdb/Merge_Request#preview | You can use this template]]. ''@@ Create template in couchdb-admin'' - -* Choose a subject like "[MERGE] Feature description" - -* Have you added tests? If not, explain why. - -* Have you added docs? If not, explain why. - -* Does `make distcheck` work reliably? If not, start over. - -* Ask people to check your code. - - * Wait 72 hours for a lazy consensus. - -* And then nudge a Release Manager if necessary! - - = Merge Testing = - - If someone has posted a merge request to the mailing list, you should test it. - - Here are some things you can do: - - * Are there any tests? - -* If not, are you happy with the rationale provided? - -* Are the tests good tests? - -* Do the tests cover the code properly? - -* Are the tests reliable? - - * Do they fail on slower systems? - - * Do they fail indeterminately? - - * Are there any docs? - -* If not, are you happy with the rationale provided? - -* Are the docs good docs? - -* Do the docs cover the code properly? - -* Are the docs easy to understand? - - * Does `make distcheck` work reliably? - - * Does the code run on multiple operating systems? - -* Can you test it under Linux? - - * Can you test it under multiple distributions? - -* Can you test it under OS X? - -* Can you test it under Windows? - - * Can you test it on multiple architectures? - -* Can you test it under 32 bit? - -* Can you test it under 64 bit? - - * Can you test it on multiple interpreters? - -* Can you test it on
[Couchdb Wiki] Update of "Merge_Request" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Merge_Request" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Merge_Request?action=diff=1=2 Comment: github PR now - <> - To request a merge of a branch or commit to a release branch, use this email template: - - Be sure to customise it to match your request. - - {{{ - To: d...@apache.couchdb.org - Subject: [MERGE] This Fancy New Feature - - Dear Release Team, - - I'd like to propose this branch to be tested and merged - into the master branch: - - 4321-feature - - The asociated JIRA ticket is: - - https://issues.apache.org/jira/browse/COUCHDB-4321 - - [X] The branch includes tests. - [X] The branch includes docs. - [X] `make distcheck` runs reliably. - - Thanks for your consideration. - - Jan - -- - - }}} -
[Couchdb Wiki] Update of "MotsRéservés" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "MotsRéservés" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/MotsR%C3%A9serv%C3%A9s?action=diff=2=3 - #language fr - Ce document décrit les propriétés qui ont une signification spéciale. - Les noms reservés commence par le caractère de soulignement '_'. - - === _id === - L'ID unique du document. - - === _rev === - La révision du document. -
[Couchdb Wiki] Update of "MessagesErreurs" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "MessagesErreurs" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/MessagesErreurs?action=diff=2=3 - #language fr - Explications et solutions aux messages d'erreurs qui peuvent survenir lors de la compilation ou de l'exécution de CouchDB. - - - == icu-config manquant == - - === Problème === - - {{{ - *** The icu-config script could not be found. Make sure it is - *** in your path, and that taglib is properly installed. - *** Or see http://ibm.com/software/globalization/icu/ - }}} - - === Solution === - - Installez ICU et utilisez `locate` pour localiser la commande `icu-config` : - - {{{ - locate icu-config - }}} - - Ajoutez le dossier indiqué par cette commande à votre `PATH`: - - {{{ - export PATH="$PATH:/usr/local/bin" - }}} - - - == LD_LIBRARY_PATH incorrect == - - === Problème === - - {{{ - $ couchdb - Apache CouchDB 0.8.0-incubating (LogLevel=info) - Apache CouchDB is starting. - - {"init terminating in do_boot",{error,{open_error,-10}}} - - Crash dump was written to: erl_crash.dump - init terminating in do_boot () - }}} - - === Solution === - - Vous devez fixer correctement la variable d'environnement `LD_LIBRARY_PATH` afin qu'elle pointe bien vers les bibliothèques installées. Dans Mac OS X, l'équivalent est `DYLD_LIBRARY_PATH`. - - Exemple pour un utilisateur normal : - - {{{ - LD_LIBRARY_PATH=/usr/local/lib:/usr/local/js/lib couchdb - }}} - - Exemple pour l'utilisateur `couchdb` : - - {{{ - echo LD_LIBRARY_PATH=/usr/local/lib:/usr/local/js/lib couchdb | sudo -u couchdb sh - }}} - - - == Architecture Binaire Incompatible == - - Sur Mac OS X, les bibliothèques et exécutables peuvent être des ''fat binaries'' qui supportent plusieurs architectures processeur (PPC and x86, 32 and 64 bit). Mais cela signifie aussi que vous pouvez avoir des problèmes lors du chargement de bibliothèque qui ne supporte pas l'archictecture sur laquelle l'application est exécutée. - - === Problème === - - {{{ - $ couchdb - Apache CouchDB 0.8.0-incubating (LogLevel=info) - Apache CouchDB is starting. - - {"init terminating in do_boot",{error,{open_error,-12}}} - - Crash dump was written to: erl_crash.dump - init terminating in do_boot () - }}} - - === Solution === - - Vous avez probablement compilé Erlang avec l'option 64 bits. Le problème est que ICU, que CouchDB tente de charger au démarrage, n'a pas été compilé avec le support 64 bits, et donc ne peut être chargé dans le processus 64 bits d'Erlang. - - Recompilez Erlang et résistez à la tentation de construire un binaire 64 bits (omettez juste l'option `--enable-darwin-64bit` ). L'option `--enable-darwin-universal` fonctionne correctement mais notez que pour l'instant il n'existe pas de binaire universel d'ICU. - - == Port non disponible == - - === Problème === - - {{{ - $ couchdb - Apache CouchDB 0.8.0-incubating (LogLevel=info) - Apache CouchDB is starting. - - ... - [error] [<0.46.0>] {error_report,<0.21.0>, - ... -{couch_httpd,start_link, -["127.0.0.1","5984","/tmp/couchdb-a/share/couchdb/www"]}}, -{restart_type,permanent}, -{shutdown,1000}, -{child_type,supervisor}]}]}} - ... - }}} - - === Solution === - - Editez le fichier `/etc/couchdb/couch.ini` et modifiez `Port`pour un port disponible. -
[Couchdb Wiki] Update of "ModificationsIncompatibles" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "ModificationsIncompatibles" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/ModificationsIncompatibles?action=diff=3=4 - #language fr - Cette page décrit les modifications incompatibles introduites lors de l'évolution de CouchDB. Certains de ces changements n'ont pas d'incidence sur les utilisateurs, mais la plupart si. Cette pages vous décrit ces changements et comment adapter votre code. - - == Changements entre 0.7.x et 0.8.0 == - - === Format du fichier de base de donnée === - - Le format du fichier de base de donnée a changé. CouchDB actuellement ne fournit pas d'outil pour migrer vos données. Vous pouvez néanmoins utiliser des scripts tiers pour effectuer cette migration tel que les outils dump/load de [[http://code.google.com/p/couchdb-python/|couchdb-python]]. - - Migration en utilisant les outils `dump`/`load` de couchdb-python - - Tout d'abord, quelques notes sur la façon dont fonctionnent ces outils : - * Ils s'appliquent sur une base de donnée, ce qui signifie que vous devrez migrer chaque base de données individuellement. - * L'outil dump récupère tous les documents avec leurs attachement d'une base de donnée dans un fichier au format MIME multipart. - * L'outil load attend un flux d'entrée au format MIME multipart et recrée tous les documents (avec leurs attachements) qu'il contient. Il doit être utilisé sur une base de donnée vide. - * Les documents conservent évidemment leurs identifiants uniques. - * L'historique des révisions est perdu. - - '''Attention'': ''Ne mettez pas à jour CouchDB avant d'avoir récupéré vos données avec la procédure ci-dessus !'' - - '''En outre''': ''N'oubliez pas de sauvegarder les fichiers d'origines ainsi que les fichiers de dump. Au moins tant que vous n'êtes pas sur que la migration soit réussie.'' - - Pour utiliser ces outils, installez `couchdb-python` , qui requiert [[http://www.python.org/|Python 2.4 et sup]] et les paquets [[http://code.google.com/p/httplib2/|httplib2]] et [[http://cheeseshop.python.org/pypi/simplejson|simplejson]]. - - Dans le shell récuperez le contenu d'une base de donnée dans un fichier en lançant la commande : - - {{{ - python couchdb/tools/dump.py http://127.0.0.1:5984/dbname > dbname.dump - }}} - - Remplaçez '''dbname''' par le nom de la base de donnée à récuperer. Un fichier `dbname.dump` est créé à l'issue de cette commande dans le répertoire courant. - - Après avoir lançé cette commande sur toutes les bases de données que vous souhaitez migrer, vous pouvez mettre à jour CouchDB. Vous aurez besoin de supprimer le dossier où CouchDB conservait les anciennes bases de données pour éviter tous problèmes avec l'ancien format. - - Après la mise à jour, vous pouvez importez les données sauvegardées. Tout d'abord, créez une base de données pour chaque dump que vous souhaitez importer. Ensuite, exécutez le script `load.py` à partir de la ligne de commande : - - {{{ - python couchdb/tools/load.py http://127.0.0.1:5984/dbname < dbname.dump - }}} - - Faîtes cela pour chaque bases de données, et vous devriez être bon. Merci de reporter tout problème avec ces scripts [[http://code.google.com/p/couchdb-python/issues/list|ici]]. - - === Changement de la structure des Documents === - - Dans la structure JSON des attachements, la propriété `content-type` a été changée en `content_type` (notez le caractère de soulignement). ce changement étais nécessaire pour homogénéiser les noms dans CouchDB, et faciliter l'accès à partir du code Javascript. - - === Changement de la définition d'une Vue. === - - Les vues supportent maintenant la propriété optionnelle 'reduce'. Pour que cela soit mis en place, la structure des documents design devait être modifiée. Voici un exemple pour illustrer ce changement : - - {{{ - { - "_id":"_design/foo", - "language":"javascript", - "views": { - "bar": { - "map":"function... ", - "reduce":"function..." - } - } - } - }}} - - Le principal changement est l'utilisation d'un objet JSON qui définit les fonctions map et reduce au lieu d'une simple chaine de caractère pour la fonction map. La propriété `reduce` peut être omise. - - La propriété `language` n'est plus un type MIME, à la place seule le nom du langage est indiqué. Le nom du langage correspond à celui choisi pour le serveur de vue dans le fichier `couch.ini`. - - la fonction `map(key, value)` que les fonctions map utilisent pour produire la sorte a été renommée `emit(key, value)` pour éviter toute confusion. - - {{{ - function(doc) { - emit(doc.foo, doc.bar); - } - }}} - - Les vues temporaires doivent maintenant `POST`er un document JSON avec les propriétés `map` et `reduce` au lieu de simplement `POST`er le source de la fonction map : - - {{{ - { - "map":"function...", -
[Couchdb Wiki] Update of "ModèlesURI" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "ModèlesURI" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Mod%C3%A8lesURI?action=diff=2=3 - #language fr - Une liste concise des [[http://bitworking.org/projects/URI-Templates/|modèles d'URI]] clés de CouchDB. - - Pour voir la liste des bases de données : - - http://localhost:5984/_all_dbs - - Pour obtenir des informations de bases sur une base de données : - - http://localhost:5984/nombd/ - - Pour obtenir une liste de tous les documents d'une base de données: - - http://localhost:5984/nombd/_all_docs - - Pour obtenir un document : - - http://localhost:5984/nombd/docid - - Pour télécharger un fichier attaché : - - http://localhost:5984/nombd/docid/_bin/filename - - Pour voir tous les documents design d'une base de données : - - http://localhost:5984/nombd/_design - - Pour obtenir un document design : - - http://localhost:5984/nombd/_design/designdocid - - Pour obtenir une vue : - - http://server/nombd/_design/designdocid/viewname -
[couchdb-documentation] branch nginx created (now bc1de63)
This is an automated email from the ASF dual-hosted git repository. wohali pushed a change to branch nginx in repository https://gitbox.apache.org/repos/asf/couchdb-documentation.git. at bc1de63 Add nginx docs This branch includes the following new commits: new bc1de63 Add nginx docs The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. -- To stop receiving notification emails like this one, please contact woh...@apache.org.
[couchdb-documentation] 01/01: Add nginx docs
This is an automated email from the ASF dual-hosted git repository. wohali pushed a commit to branch nginx in repository https://gitbox.apache.org/repos/asf/couchdb-documentation.git commit bc1de63585a917ac4b8e6b622f0319542d5dab2d Author: Joan TouzetAuthorDate: Thu Apr 12 13:26:09 2018 -0400 Add nginx docs --- src/best-practices/index.rst | 1 + src/best-practices/nginx.rst | 134 +++ 2 files changed, 135 insertions(+) diff --git a/src/best-practices/index.rst b/src/best-practices/index.rst index 0ea8c7a..362b3f1 100644 --- a/src/best-practices/index.rst +++ b/src/best-practices/index.rst @@ -26,3 +26,4 @@ system. forms jsdevel +nginx diff --git a/src/best-practices/nginx.rst b/src/best-practices/nginx.rst new file mode 100644 index 000..989f0b9 --- /dev/null +++ b/src/best-practices/nginx.rst @@ -0,0 +1,134 @@ +.. Licensed under the Apache License, Version 2.0 (the "License"); you may not +.. use this file except in compliance with the License. You may obtain a copy of +.. the License at +.. +.. http://www.apache.org/licenses/LICENSE-2.0 +.. +.. Unless required by applicable law or agreed to in writing, software +.. distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +.. WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +.. License for the specific language governing permissions and limitations under +.. the License. + +.. _best-practices/nginx: + + +nginx as a Reverse Proxy + + +CouchDB recommends the use of `HAProxy`_ as a load balancer and reverse proxy. +The team's experience with using it in production has shown it to be superior +for configuration and montioring capabilities, as well as overall performance. + +CouchDB's sample haproxy configuration is present in the `code repository`_ and +release tarball as ``rel/haproxy.cfg``. + +However, ``nginx`` is a suitable alternative. Below are instructions on +configuring nginx appropriately. + +.. _HAProxy: http://haproxy.org/ +.. _code repository: https://github.com/apache/couchdb/blob/master/rel/haproxy.cfg + +Basic configuration +=== + +Here's a basic excerpt from an nginx config file in +``/sites-available/default``. This will proxy all +requests from ``http://domain.com/...`` to ``http://localhost:5984/...`` + +.. code-block:: text + +location / { +proxy_pass http://localhost:5984; +proxy_redirect off; +proxy_set_header Host $host; +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +} + +Continuous Replication through nginx + + +The basic configuration above will **not** work correctly when attempting +continuous replication. To rectify this problem, use the following block: + +.. code-block:: text + +location ~ ^/(.*)/_changes { +proxy_pass http://localhost:5984; +proxy_redirect off; +proxy_buffering off; +proxy_set_header Host $host; +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +} + +Reverse proxying CouchDB in a subdirectory with nginx += + +It is useful to provide CouchDB as a subdirectory of your overall domain, +especially to avoid CORS concerns. Here's an excerpt of a basic nginx +configuration that proxies the URL ``http://domain.com/couchdb`` to +``http://localhost:5984`` so that requests appended to the subdirectory, such +as ``http://domain.com/couchdb/db1/doc1`` are proxied to +``http://localhost:5984/db1/doc1``. + +.. code-block:: text + +location /couchdb { +rewrite /couchdb/(.*) /$1 break; +proxy_pass http://localhost:5984; +proxy_redirect off; +proxy_set_header Host $host; +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +} + +Note that in the above configuration, the *Verify Installation* link in +Fauxton may not succeed. + +Authentication with nginx as a reverse proxy + + +Here's a sample config setting with basic authentication enabled, placing +CouchDB in the ``/couchdb`` subdirectory: + +.. code-block:: text + +location /couchdb { +auth_basic "Restricted"; +auth_basic_user_file htpasswd; +rewrite /couchdb/(.*) /$1 break; +proxy_pass http://localhost:5984; +proxy_redirect off; +proxy_set_header Host $host; +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +proxy_set_header Authorization ""; +} + +This setup leans entirely on nginx performing authorization, and forwarding +requests to CouchDB with no authentication (with CouchDB in Admin Party mode). +For a better solution, see :ref:`api/auth/proxy`. + +SSL with nginx +== + +In order to enable SSL, just enable the nginx SSL module, and add another +proxy header: + +.. code-block::
[couchdb-documentation] branch nginx deleted (was cc74ef4)
This is an automated email from the ASF dual-hosted git repository. wohali pushed a change to branch nginx in repository https://gitbox.apache.org/repos/asf/couchdb-documentation.git. was cc74ef4 Add nginx reverse proxy doc This change permanently discards the following revisions: discard cc74ef4 Add nginx reverse proxy doc -- To stop receiving notification emails like this one, please contact woh...@apache.org.
[Couchdb Wiki] Update of "Nginx_As_a_Reverse_Proxy" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Nginx_As_a_Reverse_Proxy" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Nginx_As_a_Reverse_Proxy?action=diff=11=12 Comment: migrated to http://docs.couchdb.org/en/latest/best-practices/nginx.html - <> - = nginx as a Reverse Proxy = - < > - - Nginx can serve as a reverse proxy to CouchDB for scenarios such as URL rewriting, load-balancing, access restriction, etc. - - Here's a basic excerpt from an nginx config file in /sites-available/default. This will proxy all requests from http://domain.com/... to http://localhost:5984/... - - {{{ - location / { - proxy_pass http://localhost:5984; - proxy_redirect off; - proxy_set_header Host $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } - }}} - == Continuous Replication through nginx == - The above configuration will break the continuous replication. By adding the following snippet the replication will work again: - - {{{ - location ~ ^/(.*)/_changes { - proxy_pass http://localhost:5984; - proxy_redirect off; - proxy_buffering off; - proxy_set_header Host $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } - }}} - == Reverse proxy for a subdirectory == - Here's an excerpt of a basic nginx configuration that proxies the URL "http://domain.com/couchdb; to "http://localhost:5984; so that requests appended to the subdirectory, such as "http://domain.com/couchdb/db1/doc1; are proxied to "http://localhost:5984/db1/doc1;. - - {{{ - location /couchdb { - rewrite /couchdb/(.*) /$1 break; - proxy_pass http://localhost:5984; - proxy_redirect off; - proxy_set_header Host $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } - }}} - === Known Test Suite issue with reverse proxy from subdirectory URL === - If the reverse proxy configuration also rewrites the URL for a subdirectory, the test suite will fail because it relies on the absolute root path for HTTP requests. This is a known issue and a patch has been submitted by Jack Moffitt at https://issues.apache.org/jira/browse/COUCHDB-321. - - == Authentication with reverse proxy == - Here's a sample config setting with basic authentication enabled: - - {{{ - location /couchdb { - auth_basic "Restricted"; - auth_basic_user_file htpasswd; - rewrite /couchdb/(.*) /$1 break; - proxy_pass http://localhost:5984; - proxy_redirect off; - proxy_set_header Host $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } - }}} - === Issues with reverse proxy authentication === - Enabling basic authentication in Nginx will pass the HTTP authentication header to CouchDB, invoking its authentication handler as well. This configuration causes the Nginx basic authentication prompt to appear in the browser, followed by a second authentication prompt from Couchdb, even if CouchDB authentication is not enabled. - - You can either use the same username and password combinations for both Nginx and CouchDb, or set CouchDB to use the null_authentication_handler. In the local.ini file: - - {{{ - [httpd] - authentication_handlers = {couch_httpd_auth, null_authentication_handler} - }}} - Note: As an Nginx newbie, it's probable that the original author of this wiki post just didn't know which headers to suppress or how to suppress them :-) I tried "proxy_hide_header Authorization" and "proxy_hide_header WWW-Authenticate". - - Note 2: While "proxy_hide_header" does not work, setting the header Authorization to "" seems to work. - - {{{ - location / { - auth_basic "CouchDB Admin"; - auth_basic_user_file /etc/nginx/passwd; - proxy_pass http://localhost:5984; - proxy_redirect off; - proxy_set_header Host $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Authorization ""; - } - }}} - == SSL with nginx == - In order to enable a SSL connection to your Couch you need to do two things: enable the nginx SSL module and add another proxy header: - - {{{ - ssl on; - ssl_certificate PATH_TO_YOUR_PUBLIC_KEY.pem; - ssl_certificate_key PATH_TO_YOUR_PRIVATE_KEY.key; - ssl_protocols SSLv3; - ssl_session_cache shared:SSL:1m; - - location / { - proxy_pass http://localhost:5984; - proxy_redirect off; - proxy_set_header Host $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Ssl on; - } - }}} - The X-Forwarded-Ssl header tells CouchDB that it should use the '''https''' scheme instead of the '''http''' scheme. Otherwise redirects (trailing slashes etc.) will fail. -
[couchdb] branch commit_data_pse deleted (was 33783c3)
This is an automated email from the ASF dual-hosted git repository. rnewson pushed a change to branch commit_data_pse in repository https://gitbox.apache.org/repos/asf/couchdb.git. was 33783c3 call commit_data where needed The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository. -- To stop receiving notification emails like this one, please contact rnew...@apache.org.
[couchdb] branch master updated (5b74e66 -> 3d1eecb)
This is an automated email from the ASF dual-hosted git repository. rnewson pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/couchdb.git. from 5b74e66 Set update_lru_on_read=false as default add 33783c3 call commit_data where needed new 3d1eecb Merge pull request #1281 from apache/commit_data_pse The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: src/couch/src/couch_db_updater.erl | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) -- To stop receiving notification emails like this one, please contact rnew...@apache.org.
[couchdb] 01/01: Merge pull request #1281 from apache/commit_data_pse
This is an automated email from the ASF dual-hosted git repository. rnewson pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/couchdb.git commit 3d1eecb576cc26d17d23ab1658d0d0932580a63d Merge: 5b74e66 33783c3 Author: Robert NewsonAuthorDate: Thu Apr 12 18:02:56 2018 +0100 Merge pull request #1281 from apache/commit_data_pse call commit_data where needed src/couch/src/couch_db_updater.erl | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) -- To stop receiving notification emails like this one, please contact rnew...@apache.org.
[couchdb] 01/01: call commit_data where needed
This is an automated email from the ASF dual-hosted git repository. rnewson pushed a commit to branch commit_data_pse in repository https://gitbox.apache.org/repos/asf/couchdb.git commit 33783c3deacfa9d869171145a32d77453e862c99 Author: Robert NewsonAuthorDate: Thu Apr 12 17:26:28 2018 +0100 call commit_data where needed Regression since introduction of PSE --- src/couch/src/couch_db_updater.erl | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/couch/src/couch_db_updater.erl b/src/couch/src/couch_db_updater.erl index 79567e9..a2de3bc 100644 --- a/src/couch/src/couch_db_updater.erl +++ b/src/couch/src/couch_db_updater.erl @@ -82,16 +82,17 @@ handle_call(cancel_compact, _From, #db{compactor_pid = Pid} = Db) -> handle_call({set_security, NewSec}, _From, #db{} = Db) -> {ok, NewDb} = couch_db_engine:set_security(Db, NewSec), -NewSecDb = NewDb#db{ +NewSecDb = commit_data(NewDb#db{ security = NewSec -}, +}), ok = gen_server:call(couch_server, {db_updated, NewSecDb}, infinity), {reply, ok, NewSecDb, idle_limit()}; handle_call({set_revs_limit, Limit}, _From, Db) -> {ok, Db2} = couch_db_engine:set_revs_limit(Db, Limit), -ok = gen_server:call(couch_server, {db_updated, Db2}, infinity), -{reply, ok, Db2, idle_limit()}; +Db3 = commit_data(Db2), +ok = gen_server:call(couch_server, {db_updated, Db3}, infinity), +{reply, ok, Db3, idle_limit()}; handle_call({purge_docs, _IdRevs}, _From, #db{compactor_pid=Pid}=Db) when Pid /= nil -> @@ -160,12 +161,12 @@ handle_call({purge_docs, IdRevs}, _From, Db) -> Pairs = pair_purge_info(PreviousFDIs, FDIs), {ok, Db2} = couch_db_engine:write_doc_infos(Db, Pairs, [], PurgedIdRevs), - -ok = gen_server:call(couch_server, {db_updated, Db2}, infinity), +Db3 = commit_data(Db2), +ok = gen_server:call(couch_server, {db_updated, Db3}, infinity), couch_event:notify(Db#db.name, updated), -PurgeSeq = couch_db_engine:get_purge_seq(Db2), -{reply, {ok, PurgeSeq, PurgedIdRevs}, Db2, idle_limit()}; +PurgeSeq = couch_db_engine:get_purge_seq(Db3), +{reply, {ok, PurgeSeq, PurgedIdRevs}, Db3, idle_limit()}; handle_call(Msg, From, Db) -> case couch_db_engine:handle_db_updater_call(Msg, From, Db) of -- To stop receiving notification emails like this one, please contact rnew...@apache.org.
[couchdb] branch commit_data_pse updated (1aa280c -> 33783c3)
This is an automated email from the ASF dual-hosted git repository. rnewson pushed a change to branch commit_data_pse in repository https://gitbox.apache.org/repos/asf/couchdb.git. omit 1aa280c call commit_data where needed new 33783c3 call commit_data where needed This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (1aa280c) \ N -- N -- N refs/heads/commit_data_pse (33783c3) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: src/couch/test/fixtures/test.couch | Bin 0 -> 16482 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/couch/test/fixtures/test.couch -- To stop receiving notification emails like this one, please contact rnew...@apache.org.
[Couchdb Wiki] Update of "OneLaptopPerChild" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "OneLaptopPerChild" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/OneLaptopPerChild?action=diff=3=4 - #redirect One_laptop_per_child - The One Laptop Per Child XO laptop is based on Fedora Linux, it can run CouchDB. The OLPC user interface and the applications (or activities in OLPC terminology) are written in Python with the ''python-gtk'' library. It would seem logical to have a CouchDB client written in Python for this platform. - == Applications == - - * One database per child with a replica of each on the teachers laptop. - * Personal Journal - * Homework assignments with marking replicating back from the teacher to the student - * One database per class with replicas on every laptop in the class - * Polls - * Synchronous/asynchronous chat messaging - - == Features == - - * Opportunistic replication - - If a couchDB server sees another one on the local network via Avahi it should replicate databases in common. - - * Real time replication when available - - All client applications should always be pointing at the local couchdb server. Real time replication when available would mean there is never a distinction between using the local replica and server replicas. If there is connectivity then updates should happen just as fast as if the clients were talking to the server directly. - - * Database list discovery - - A couchdb server should be able to discover databases in common between it and another couchdb server. Initially this would be by iterating through the databases and passing each other a big list. It would be good to have a URL that returns the server name and an MD5 hash of it's list of databases. This would allow one laptop to meet another and quickly decide whether or not the database list of the other has changed since they last met. -
[Couchdb Wiki] Update of "OpenItems" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "OpenItems" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/OpenItems?action=diff=5=6 - #redirect Open_items - Open items related to the CouchDB project that anyone can work on. - == Documentation Graphics == - - The documentation, especially the introductions, could use some basic diagrams that show various the parts of a CouchDB server: Host OS, Application HTTP server, CouchDB database server (Server contains database which contain document which contain computed tables etc). - - == Configuration == - - Note: This is currently being worked on. Check with the couchdb-dev (http://incubator.apache.org/couchdb/community/lists.html) mailing list for a status. - - CouchDB needs a configuration/setting process that loads and parses the ''couch.ini'' file and provides the interface for internal processes to get and set couchdb system settings. This way admins can changes settings from the Erlang consol and via http. - - The module should be able to write out changes (variable edits, additions, and deletions) to the ini file without losing whitespace or comments in the original file. It should be possible to register change event callbacks, so that callers can be notified when a value changes. - - == Collation Optimizations == - - Right now CouchDB uses the [[http://www.icu-project.org/|ICU library]] from IBM for collation support. CouchDB currently uses a rather slow method of interfacing with the library, which is to copy the UTF8 string lists to binary buffers and then provide the buffers to ICU to do the comparison. More optimized methods of interfacing with ICU could be used, or just do the collation in native erlang using generated code to create the collation tables. -
[Couchdb Wiki] Update of "Problèmes" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Problèmes" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Probl%C3%A8mes?action=diff=5=6 Comment: outdated - == Mise à jour == - Avez-vous compilé CouchDB à partir du dépot Subversion? - - Avez vous exécuté un `svn up` qui semble tout casser ? - - Après chaque mise à jour, vous devez lancer la commande suivante : - - {{{ - ./bootstrap -C - }}} - - Si vous avez encore des problèmes, essayez le point suivant. - - == Premier lancement == - - Avez-vous des problèmes au lancement de CouchDB la première fois ? - - Suivez cette simple procédure et reportez le résultat de chaque étape sur la liste de diffusion (ou IRC). - - 1. Indiquez le nom de votre système d'exploitation et de votre architecture processeur. - - 2. Indiquez les versions des dépendances de CouchDB installées. - - 3. Suivez [[http://incubator.apache.org/couchdb/community/code.html|les instructions de checkout]] pour obtenir une copie récente du trunk. - - 4. Bootstrap à partir du dossier `couchdb` : - - {{{ - ./bootstrap -C - }}} - - 5. Compilez dans un dossier temporaire : - {{{ - ./configure --prefix=/tmp/couchdb && make && make install - }}} - - 6. Exécutez la commande couchdb et enregistrez le résultat : - - {{{ - /tmp/couchdb/bin/couchdb - }}} - - 7. Utilisez votre outil de traçage et enregistrez le résultat de la commande précedente. - - 1. Sur les systèmes Linux utilisez de préférence strace: - - {{{ - strace /tmp/couchdb/bin/couchdb 2> strace.out - }}} - - 2. Merci d'ajouter la documentation pour votre système... - - 8. Reportez le résultat de chaque étape sur la liste de diffusion (ou IRC). -
[Couchdb Wiki] Update of "RegénérationVuesÀlaMiseAjour" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "RegénérationVuesÀlaMiseAjour" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Reg%C3%A9n%C3%A9rationVues%C3%80laMiseAjour?action=diff=2=3 Comment: Obsolete and non-functional - #language fr - = Mettre à jour les vues lors de l'enregistrement d'un document = - - Par défaut CouchDB regénère les vues la première fois qu'elles sont appelées. Ce comportement est adéquat pour la plupart des cas dans la mesure où il optimise l'utilisation des resources sur le serveur de base de données. - - Mais dans certains cas, il est préférables d'avoir rapidement des vues à jour malgré le coût créée par une mise à jour systématique à chaque fois que le serveur reçoit une mise à jour. On peut réaliser cela en fournissant un script de mise à jour qui appelle les vues lorsque cela est nécessaire. - - == Exemple utilisant ruby == - - === couch.ini === - Ajoutez la lignes suivante au fichier couch.ini {{{ - DbUpdateNotificationProcess=/PATH/TO/view_updater.rb - }}} - - === view_updater.rb === - Le script suivant met à jour les vues toutes les 10 mises à jour reçues par la base de données ou une fois / secondes lorsque le nombre d'enregistrement est important {{{ - #!/usr/bin/ruby - - ### - # CONF# - ### - - # The smallest amount of changed documents before the views are updated - MIN_NUM_OF_CHANGED_DOCS = 10 - - # URL to the DB on the CouchDB server - URL = "http://localhost:5984; - - # Set the minimum pause between calls to the database - PAUSE = 1 # seconds - - # One entry for each design document - # in each database - VIEWS = {"DATABASE_NAME" => ["list_of/design_documents", - "another/design_document"], - "recipes"=> ["category/most_popular"], - "ingredients"=> ["by/price"]} - - - ### - # RUNTIME # - ### - - run = true - number_of_changed_docs = {} - - threads = [] - - # Updates the views - threads << Thread.new do - - while run do - - number_of_changed_docs.each_pair do |db_name, number_of_docs| - if number_of_docs >= MIN_NUM_OF_CHANGED_DOCS - - # Reset the value - number_of_changed_docs[db_name] = 0 - - # If there are views in the database, get them - if VIEWS[db_name] - VIEWS[db_name].each do |view| - `curl #{URL}/#{db_name}/_view/#{view}?count=0` - end - end - - end - end - - # Pause before starting over again - sleep PAUSE - - end - - end - - # Receives the update notification from CouchDB - threads << Thread.new do - - while run do - - puts "Waiting for input:" - update_call = gets - - # When CouchDB exits the script gets called with - # a never ending series of nil - if update_call == nil - run = false - else - - # Get the database name out of the call data - # The data looks somethind like this: - # {"type":"updated","db":"DB_NAME"}\n - update_call =~ /\"db\":\"(\w+)\"/ - database_name = $1 - - # Set to 0 if it hasn't been initialized before - number_of_changed_docs[$1] ||= 0 - - # Add one pending changed document to the list of documents - # in the DB - number_of_changed_docs[$1] += 1 - - end - - end - - end - - # Good bye - threads.each {|thr| thr.join} - - }}} - - view_updater.rb doit être exécutable par CouchDB . -
[Couchdb Wiki] Update of "SynthèseApi" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "SynthèseApi" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Synth%C3%A8seApi?action=diff=3=4 - #language fr - Une fiche de synthèse de l'API. - - ''Si vous avez le temps n'hésitez pas ;)'' -
[Couchdb Wiki] Update of "Purge_Documents" by JoanTouzet
Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification. The page "Purge_Documents" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Purge_Documents?action=diff=5=6 Comment: Migrated to official docs - The '''_purge''' operation removes all references to the deleted revisions -- and their parents -- from the database. (This is very different from a normal delete, which actually ''adds'' a "tombstone" revision.) In a sense it edits history, similarly to a Git "reset": the revisions will no longer appear in the revision tree. It's as though the database had never heard of them at all. - == Reasons To (And Not To) Purge == - - So, you've included your credit card details, your mother's maiden name and the PIN's to all your major credit cards in a CouchDB document by mistake. You'd like to undo this. Usually, you can simply update the document, removing the confidential data, and then compact the database. However, let's say you really messed up and included this secret information in the document's id field. You remember that CouchDB will remember all the latest {id, rev} pairs it's ever seen (so that replication can make all replicas eventually consistent). Are you paddling down an unpleasant stream with no means of steering? Fortunately not! You can purge. - - If you are using _purge to recover space, you are almost certainly using CouchDB inappropriately. The most common reason developers use _purge inappropriately is when managing short-lived data (log entries, message queues, etc). A better remedy is to periodically switch to a new database and delete the old one (once the entries in it have all expired). - - == Eligibility For Purging == - - A revision parameter to _purge must be a ''leaf'' in the revision tree. This means it must be the current revision, or one of the current conflicting revisions. This is because a revision that has already been replaced by another is not a leaf node of the revision tree, so removing it would break the integrity of the tree. - - When a revision is purged, its ancestors are purged if possible. Ancestors will be kept if necessary to preserve the integrity of the tree; this only happens if there have been conflicts and they are either unresolved or haven't yet been compacted away. - - == The _purge Command == - - To perform a purge operation you must send a JSON object, where the keys are the IDs to purge and each value is a list of the revisions to purge. Typically you'd just specify the current revision ID, which will purge the entire document unless there are conflicts. To purge an entire document while it's in conflict, you need to send each conflicting revision ID. - - For example: - {{{ - POST /mydb/_purge - Content-Type: application/json - - { - "c7a59f0d08d28928a62124fa16000ea7" : [ - "2-02be3a9b23b4402160ad678e208afb8e" - ] - } - }}} - - The response will contain the purge sequence number, and a list of the document IDs and revisions successfully purged. - - {{{ - { -"purged" : { - "c7a59f0d08d28928a62124fa16000ea7" : [ - "2-02be3a9b23b4402160ad678e208afb8e" - ] -}, -"purge_seq" : 1 - } - }}} - - The '''purge sequence number''' is simply a persistent per-database counter that is incremented every time a _purge operation is performed. It's used internally to invalidate view indexes. - - == Side Effects == - - If you have purged more than one document between querying your views, you will find that they will rebuild from scratch. This is because you have removed the information necessary to perform a correct incremental update. - - If the purged revisions still exist in a another replica of the database, a replication with that database will pull them over again and restore them. To globally remove the revisions, the purge needs to be performed on all the replicas as well, ensuring that replication is stopped during this operation, to avoid them being replicated back again. -