1.2.22. Configuration

The CouchDB Server Configuration API provide an interface to query and update the various configuration values within a running CouchDB instance.

1.2.22.1. Accessing the local node’s configuration

The literal string _local serves as an alias for the local node name, so for all configuration URLs, {node-name} may be replaced with _local, to interact with the local node’s configuration.

1.2.22.2. /_node/{node-name}/_config

GET /_node/{node-name}/_config

Returns the entire CouchDB server configuration as a JSON structure. The structure is organized by different configuration sections, with individual values.

Request Headers:
 
  • Accept
    • application/json
    • text/plain
Response Headers:
 
Status Codes:
  • 200 OK – Request completed successfully
  • 401 Unauthorized – CouchDB Server Administrator privileges required

Request

  1. GET /_node/nonode@nohost/_config HTTP/1.1
  2. Accept: application/json
  3. Host: localhost:5984

Response:

  1. HTTP/1.1 200 OK
  2. Cache-Control: must-revalidate
  3. Content-Length: 4148
  4. Content-Type: application/json
  5. Date: Sat, 10 Aug 2013 12:01:42 GMT
  6. Server: CouchDB (Erlang/OTP)
  7. {
  8. "attachments": {
  9. "compressible_types": "text/*, application/javascript, application/json, application/xml",
  10. "compression_level": "8"
  11. },
  12. "couchdb": {
  13. "users_db_suffix": "_users",
  14. "database_dir": "/var/lib/couchdb",
  15. "max_attachment_chunk_size": "4294967296",
  16. "max_dbs_open": "100",
  17. "os_process_timeout": "5000",
  18. "uri_file": "/var/lib/couchdb/couch.uri",
  19. "util_driver_dir": "/usr/lib64/couchdb/erlang/lib/couch-1.5.0/priv/lib",
  20. "view_index_dir": "/var/lib/couchdb"
  21. },
  22. "chttpd": {
  23. "backlog": "512",
  24. "bind_address": "0.0.0.0",
  25. "port": "5984",
  26. "require_valid_user": "false",
  27. "socket_options": "[{sndbuf, 262144}, {nodelay, true}]",
  28. "server_options": "[{recbuf, undefined}]"
  29. },
  30. "httpd": {
  31. "allow_jsonp": "false",
  32. "authentication_handlers": "{couch_httpd_auth, cookie_authentication_handler}, {couch_httpd_auth, default_authentication_handler}",
  33. "bind_address": "192.168.0.2",
  34. "max_connections": "2048",
  35. "port": "5984",
  36. "secure_rewrites": "true"
  37. },
  38. "log": {
  39. "writer": "file",
  40. "file": "/var/log/couchdb/couch.log",
  41. "include_sasl": "true",
  42. "level": "info"
  43. },
  44. "query_server_config": {
  45. "reduce_limit": "true"
  46. },
  47. "replicator": {
  48. "max_http_pipeline_size": "10",
  49. "max_http_sessions": "10"
  50. },
  51. "stats": {
  52. "interval": "10"
  53. },
  54. "uuids": {
  55. "algorithm": "utc_random"
  56. }
  57. }

1.2.22.3. /_node/{node-name}/_config/{section}

GET /_node/{node-name}/_config/{section}

Gets the configuration structure for a single section.

Parameters:
  • section – Configuration section name
Request Headers:
 
  • Accept
    • application/json
    • text/plain
Response Headers:
 
Status Codes:
  • 200 OK – Request completed successfully
  • 401 Unauthorized – CouchDB Server Administrator privileges required

Request:

  1. GET /_node/nonode@nohost/_config/httpd HTTP/1.1
  2. Accept: application/json
  3. Host: localhost:5984

Response:

  1. HTTP/1.1 200 OK
  2. Cache-Control: must-revalidate
  3. Content-Length: 444
  4. Content-Type: application/json
  5. Date: Sat, 10 Aug 2013 12:10:40 GMT
  6. Server: CouchDB (Erlang/OTP)
  7. {
  8. "allow_jsonp": "false",
  9. "authentication_handlers": "{couch_httpd_auth, cookie_authentication_handler}, {couch_httpd_auth, default_authentication_handler}",
  10. "bind_address": "127.0.0.1",
  11. "default_handler": "{couch_httpd_db, handle_request}",
  12. "enable_cors": "false",
  13. "port": "5984",
  14. "secure_rewrites": "true"
  15. }

1.2.22.4. /_node/{node-name}/_config/{section}/{key}

GET /_node/{node-name}/_config/{section}/{key}

Gets a single configuration value from within a specific configuration section.

Parameters:
  • section – Configuration section name
  • key – Configuration option name
Request Headers:
 
  • Accept
    • application/json
    • text/plain
Response Headers:
 
Status Codes:
  • 200 OK – Request completed successfully
  • 401 Unauthorized – CouchDB Server Administrator privileges required

Request:

  1. GET /_node/nonode@nohost/_config/log/level HTTP/1.1
  2. Accept: application/json
  3. Host: localhost:5984

Response:

  1. HTTP/1.1 200 OK
  2. Cache-Control: must-revalidate
  3. Content-Length: 8
  4. Content-Type: application/json
  5. Date: Sat, 10 Aug 2013 12:12:59 GMT
  6. Server: CouchDB (Erlang/OTP)
  7. "debug"

PUT /_node/{node-name}/_config/{section}/{key}

Updates a configuration value. The new value should be supplied in the request body in the corresponding JSON format. If you are setting a string value, you must supply a valid JSON string. In response CouchDB sends old value for target section key.

Parameters:
  • section – Configuration section name
  • key – Configuration option name
Request Headers:
 
Response Headers:
 
Status Codes:

Request:

  1. PUT /_node/nonode@nohost/_config/log/level HTTP/1.1
  2. Accept: application/json
  3. Content-Length: 7
  4. Content-Type: application/json
  5. Host: localhost:5984
  6. "info"

Response:

  1. HTTP/1.1 200 OK
  2. Cache-Control: must-revalidate
  3. Content-Length: 8
  4. Content-Type: application/json
  5. Date: Sat, 10 Aug 2013 12:12:59 GMT
  6. Server: CouchDB (Erlang/OTP)
  7. "debug"

DELETE /_node/{node-name}/_config/{section}/{key}

Deletes a configuration value. The returned JSON will be the value of the configuration parameter before it was deleted.

Parameters:
  • section – Configuration section name
  • key – Configuration option name
Request Headers:
 
  • Accept
    • application/json
    • text/plain
Response Headers:
 
Status Codes:

Request:

  1. DELETE /_node/nonode@nohost/_config/log/level HTTP/1.1
  2. Accept: application/json
  3. Host: localhost:5984

Response:

  1. HTTP/1.1 200 OK
  2. Cache-Control: must-revalidate
  3. Content-Length: 7
  4. Content-Type: application/json
  5. Date: Sat, 10 Aug 2013 12:29:03 GMT
  6. Server: CouchDB (Erlang/OTP)
  7. "info"

1.2.22.5. /_node/{node-name}/_config/_reload

New in version 3.0.

POST /_node/{node-name}/_config/_reload

Reloads the configuration from disk. This has a side effect of flushing any in-memory configuration changes that have not been committed to disk.

Request:

  1. POST /_node/nonode@nohost/_config/_reload HTTP/1.1
  2. Host: localhost:5984

Response:

  1. HTTP/1.1 200 OK
  2. Cache-Control: must-revalidate
  3. Content-Length: 12
  4. Content-Type: application/json
  5. Date: Tues, 21 Jan 2020 11:09:35
  6. Server: CouchDB/3.0.0 (Erlang OTP)
  7. {"ok":true}