A newer version of this documentation is available.

View Latest

Adding Nodes to Groups

  • reference
    +
    A node can be added to the cluster and simultaneously added to an existing server group with the POST /pools/default/serverGroups/<:uuid>/addNode HTTP method and URI.

    HTTP method and URI

    POST /pools/default/serverGroups/<:uuid>/addNode

    Description

    This adds a node to a cluster, and assigns it to the specified group. Optionally, it assigns services to the node. These can be kv (Data), index (Index), n1ql (Query), eventing (Eventing), fts (Search), cbas (Analytics), or backup (Backup). If none is specified, the Data Service is assigned by default.

    For a conceptual overview of nodes, and of the process of adding nodes to clusters, see Nodes. In particular, note that the node to be added needs only to have been installed and started. If it has been initialized, data-paths so established will be retained, following addition. However, if the node to be added has been provisioned, all results of that provisioning will be deleted by the addition-process. This includes services, memory-quotas, buckets, bucket-data, and all established usernames and passwords.

    Following successful addition, rebalance is required. For a conceptual overview, see Rebalance. For examples of performing rebalance, see Rebalancing Nodes.

    Curl Syntax

    curl -X POST -d hostname=<host>:<port>
      -d services=<kv|index|n1ql|fts|cbas|eventing>
      -d user=<administrator>
      -d password=<password>
      -u <administrator>:<password>
      http://<host>:<port>/pools/default/serverGroups/<uuid>/addNode

    The syntax includes the following:

    • hostname. The hostname and port of the node to be added.

    • user and password. The username and password for the node to be added. If the node has not yet been provisioned, placeholder username and password should be specified.

    • uuid. This path-parameter identifies the server group to which the node is to be assigned. To retrieve this prior to node-addition, use the procedure described in Getting Server Group Information.

    Responses

    Success gives 200 OK, and returns an object signifying that the nodes specified for addition has been duly added to the cluster (see the example given below). An incorrectly specified uuid gives 404 Object Not Found, and returns an object of the form ["Could not find group with uuid: <submitted-uuid>"]. Failure to authenticate gives 401 Unauthorized. Failure to specify username and password for the node to be added gives 400 Bad Request, and returns an object of the form ["user is missing","password is missing"].

    Example

    The following example assumes that the cluster has two groups, Group 1 and Group 2. The uuid for Group 2 has been returned as 246b5de857e100dbfd8b6dee0406420a. The following request therefore adds a new node, 10.143.190.104 to the cluster, and assigns it to Group 2. The Data and Index Services are deployed to the new node.

    curl -X POST -d hostname=10.143.190.104:8091 \
    -d services=kv%2Cindex \
    -d user=Administrator -d password=password \
    -u Administrator:password \
    http://10.143.190.101:8091/pools/default/serverGroups/\
    3b66b3c3177f44a3ffa6771ffeb31f36/addNode

    If successful, the request returns the following object, which indicates that the new node has been added to the cluster:

    {"otpNode":"ns_1@10.143.190.104"}

    See Also

    For a conceptual overview of nodes, and of the process of adding nodes to clusters, see Nodes. See Getting Server Group Information for getting information on the current node-to-group configuration for the server. For examples of performing rebalance, see Rebalancing Nodes. See Server Group Awareness, for a conceptual overview of groups. See Manage Groups, for examples of managing groups by means of Couchbase Web Console.