Managing Cluster Connections

    By means of the REST API, the maximum permitted numbers of connections can be established and retrieved for memcached connections, and for system-user connections, for the cluster.

    HTTP Methods and URIs

    POST /pools/default/settings/memcached/global
    
    GET /pools/default/settings/memcached/global

    Couchbase supports the REST API DELETE pools/default/settings/memcached/global/setting/[setting_name] for the following settings that are not always passed from the Cluster Manager to memcached:

    • default_reqs_per_event

    • reqs_per_event_high_priority

    • reqs_per_event_med_priority

    • reqs_per_event_low_priority

    • threads

    • dcp_disconnect_when_stuck_timeout_seconds

    • dcp_disconnect_when_stuck_name_regex

    • external_auth_request_timeout

    • not_locked_returns_tmpfail

    • clustermap_push_notifications_enabled

    • magma_blind_write_optimisation_enabled

    Description

    A Couchbase-Server cluster allows connections to be established, both for memcached and for authenticated system-users. In each case, a maximum permitted number of connections can be established for the cluster, and can be retrieved.

    The Full Admin or Cluster Admin role is required.

    Curl Syntax

    curl -u <username>:<password> -X POST
      <ip-address-or-domain-name>:8091/pools/default/settings/memcached/global
      -d max_connections=<integer>
      -d system_connections=<integer>
    
    curl -u <username>:<password> -X GET
      <ip-address-or-domain-name>:8091/pools/default/settings/memcached/global

    The integer specified as the value for max_connections determines the maximum number of connections that can be established by memcached for the cluster. The integer specified as the value for system_connections determines the maximum number of connections that can be established by authenticated system-users for the cluster.

    Responses

    Successful use of GET returns 200 OK, and an object containing a key-value pair for each established setting.

    Successful use of POST returns 202 Accepted, and an object containing a key-value pair for any established setting.

    A malformed URI returns 404 Object Not Found.

    Failure to authenticate returns 401 Unauthorized. Successful authentication with an inappropriate role returns 403 Forbidden, and an object such as the following: {"message":"Forbidden. User needs the following permissions","permissions":["cluster.admin.memcached!read"]}.

    Specifying, in a POST, an integer whose size is excessive for the environment returns 400 Bad Request, and an object such as the following: {"system_connections":"too_large"}.

    Examples

    The following example sets the maximum number of connections for authenticated system-users to 50000:

    curl -u Administrator:password -v -X POST \
    localhost:8091/pools/default/settings/memcached/global \
    -d system_connections=50000

    If successful, the call returns an object such as the following:

    {"system_connections":50000}

    The following example sets the maximum number of connections for memcached to 650000:

    curl -u Administrator:password -X POST \
    localhost:8091/pools/default/settings/memcached/global \
    -d  max_connections=650000

    If successful, the call returns an object such as the following:

    {"max_connections":650000,"system_connections":50000}

    The returned object thus indicates that both max_connections and system_connections have now been set.

    The following example returns the current settings for the cluster:

    curl -u Administrator:password -v -X GET \
    localhost:8091/pools/default/settings/memcached/global

    If successful, the call returns an object such as the following:

    {"max_connections":650000,"system_connections":50000}

    See Also

    A summary of Couchbase-Server size limits is provided in Size Limits.