Listing Nodes by Bucket

  • reference
    +
    The nodes of a cluster on which a particular bucket resides can be listed with the GET /pools/default/buckets//nodes method and URI.

    HTTP method and URI

    GET /pools/default/buckets/<bucket-name>/nodes

    Description

    This lists all nodes that are members of a specified cluster on which a specified bucket resides. The information includes, for each node, the URI of the node itself, plus the URI for statistics corresponding to the specified bucket. Information on all the cluster’s nodes, including nodes that do not host the Data Service, is included in the returned object.

    Curl Syntax

    curl -X GET -u <administrator>:<password>
       http://<host>:<port>/pools/default/buckets/<bucket-name>/nodes

    The <bucket-name> must be the name of a bucket defined on the cluster.

    Responses

    If successful, 200 OK is given, and an object containing node-related information for the specified bucket is returned.

    A malformed URI gives 400 Object Not Found. Failure to authenticate gives 401 Unauthorized. Specifying a non-existent bucket produces a 404 Object Not Found error, and a Requested resource not found message.

    Returned-Object Contents

    The returned object contains a servers array, each of whose members is an object containing the hostname and uri of a node, plus the uri for obtaining bucket-related stats on the node.

    Example

    The following example lists nodes the on the cluster 10.143.192.101, which contains the bucket travel-sample.

    curl -v -X GET -u Administrator:password \
    http://10.143.192.101:8091/pools/default/buckets/travel-sample/nodes | jq

    Note that the call is piped to the jq tool, to enhance the readability of the output.

    There are three nodes on the cluster, which are 10.143.109.101 and 10.143.192.102, which both host the Data Service; and 10.143.192.103, which does not host the Data Service. The response is as follows:

    {
      "servers": [
        {
          "hostname": "10.143.192.101:8091",
          "uri": "/pools/default/buckets/travel-sample/nodes/10.143.192.101%3A8091",
          "stats": {
            "uri": "/pools/default/buckets/travel-sample/nodes/10.143.192.101%3A8091/stats"
          }
        },
        {
          "hostname": "10.143.192.102:8091",
          "uri": "/pools/default/buckets/travel-sample/nodes/10.143.192.102%3A8091",
          "stats": {
            "uri": "/pools/default/buckets/travel-sample/nodes/10.143.192.102%3A8091/stats"
          }
        },
        {
          "hostname": "10.143.192.103:8091",
          "uri": "/pools/default/buckets/travel-sample/nodes/10.143.192.103%3A8091",
          "stats": {
            "uri": "/pools/default/buckets/travel-sample/nodes/10.143.192.103%3A8091/stats"
          }
        }
      ]
    }

    The uri for stats, provided for each node, can be used to retrieve bucket-statistics for the node. In this case, if used in such a query, the uri for 10.143.192.103 returns an object that indicates the specified bucket is not present.

    See Also

    For information on returning per node statistics on a specified bucket, see the reference page for Getting Bucket Statistics.