4.2. Base Configuration

4.2.1. Base CouchDB Options

[couchdb]


attachmentstream_buffer_size
Higher values may result in better read performance due to fewer readoperations and/or more OS page cache hits. However, they can alsoincrease overall response time for writes when there are manyattachment write requests in parallel.

  1. [couchdb]
    attachment_stream_buffer_size = 4096


database_dir
Specifies location of CouchDB database files (*.couch named). Thislocation should be writable and readable for the user the CouchDBservice runs as (couchdb by default).

  1. [couchdb]
    database_dir = /var/lib/couchdb


default_security
Default security object for databases if not explicitly set. When set to everyone, anyone can performs reads and writes. When set to admin_only, only admins can read and write. When set to admin_local, sharded databases can be read and written by anyone but the shards can only be read and written by admins.
[couchdb]default_security = admin_local
delayed_commits
When this config value is false the CouchDB provides a guaranteethat _fsync will be called before returning a 201 Createdresponse on each document save. Setting this config value to truemay improve performance, at cost of some durability. For production usedisabling this is strongly recommended:

  1. [couchdb]
    delayedcommits = false


WarningDelayed commits are a feature of CouchDB that allows it to achievebetter write performance for some workloads while sacrificing asmall amount of durability. The setting causes CouchDB to wait upto a full second before committing new data after an update. If theserver crashes before the header is written then any writes sincethe last commit are lost.
file_compression
Changed in version 1.2: Added Google Snappy compression algorithm.Method used to compress everything that is appended to database andview index files, except for attachments (see theattachments section). Available methods are:- none: no compression- snappy: use Google Snappy, a very fast compressor/decompressor- deflate_N: use zlib’s deflate; N is the compression levelwhich ranges from 1 (fastest, lowest compression ratio) to 9(slowest, highest compression ratio)

  1. [couchdb]
    file_compression = snappy


fsync_options
Specifies when to make _fsync calls. fsync makes sure that thecontents of any file system buffers kept by the operating system areflushed to disk. There is generally no need to modify this parameter.

  1. [couchdb]
    fsyncoptions = [before_header, after_header, on_file_open]


max_dbs_open
This option places an upper bound on the number of databases that canbe open at once. CouchDB reference counts database accesses internallyand will close idle databases as needed. Sometimes it is necessary tokeep more than the default open at once, such as in deployments wheremany databases will be replicating continuously.

  1. [couchdb]
    max_dbs_open = 100


os_process_timeout
If an external process, such as a query server or external process,runs for this amount of milliseconds without returning any results, itwill be terminated. Keeping this value smaller ensures you getexpedient errors, but you may want to tweak it for your specificneeds.

  1. [couchdb]
    os_process_timeout = 5000 ; 5 sec


uri_file
This file contains the full URI that can be used to access thisinstance of CouchDB. It is used to help discover the port CouchDB isrunning on (if it was set to 0 (e.g. automatically assigned anyfree one). This file should be writable and readable for the user thatruns the CouchDB service (couchdb by default).

  1. [couchdb]
    uri_file = /var/run/couchdb/couchdb.uri





users_db_suffix


Specifies the suffix (last component of a name) of the system databasefor storing CouchDB users.

  1. [couchdb]
    users_db_suffix = _users


WarningIf you change the database name, do not forget to remove or cleanup the old database, since it will no longer be protected byCouchDB.


util_driver_dir

Specifies location of binary drivers (_icu
, ejson, etc.). Thislocation and its contents should be readable for the user that runs theCouchDB service.




  1. [couchdb]
    utildriver_dir = /usr/lib/couchdb/erlang/lib/couch-1.5.0/priv/lib



uuid


New in version 1.3.


Unique identifier for this CouchDB server instance.




  1. [couchdb]
    uuid = 0a959b9b8227188afc2ac26ccdf345a6



view_index_dir

Specifies location of CouchDB view index files. This location should bewritable and readable for the user that runs the CouchDB service(couchdb by default).




  1. [couchdb]
    view_index_dir = /var/lib/couchdb



maintenance_mode

A CouchDB node may be put into two distinct maintenance modes by settingthis configuration parameter.

- true: The node will not respond to clustered requests from othernodes and the /_up endpoint will return a 404 response.
- nolb: The /_up endpoint will return a 404 response.
- false: The node responds normally, /_up returns a 200 response.
It is expected that the administrator has configured a load balancerin front of the CouchDB nodes in the cluster. This load balancer shoulduse the /_up endpoint to determine whether or not to send HTTP requeststo any particular node. For HAProxy, the following config isappropriate:




  1. http-check disable-on-404
    option httpchk GET /_up



max_document_size


Changed in version 2.1.0.


Limit maximum document body size. Size is calculated based on theserialized Erlang representation of the JSON document body, becausethat reflects more accurately the amount of storage consumed on disk.In particular, this limit does not include attachments.

HTTP requests which create or update documents will fail with errorcode 413 if one or more documents is larger than this configurationvalue.

In case of __update
handlers, document size is checked after thetransformation and right before being inserted into the database.




  1. [couchdb]
    maxdocument_size = 4294967296 ; 4 GB





Warning

Before version 2.1.0 this setting was implemented by simply checkinghttp request body sizes. For individual document updates via _PUT_that approximation was close enough, however that is not the casefor __bulk_docs
endpoint. After 2.1.0 a separate configurationparameter was defined: httpd/max_http_request_size,which can be used to limit maximum http request sizes. After upgrade,it is advisable to review those settings and adjust them accordingly.

原文: http://docs.couchdb.org/en/stable/config/couchdb.html