Adding a Node

Adding a Node

Full Administrators and Cluster Administrators can use the UI, CLI, or REST API interface to add a node.

There are several methods for adding a node to a cluster. In each case, one or more nodes are marked to be added to the cluster, but it doesn't become an active member of the cluster until you rebalance the cluster.

In a CLI call, the rebalance can optionally be done while adding the new nodes. When using the UI, rebalancing requires an extra click.

Add a Node during Initial Installation

When setting up a new Couchbase Server installation, you have the option to join the new node to an existing cluster.

During the first step, select the Join a cluster now radio button, as shown in the figure below:

Enter the following information:

Field Description
IP Address The IP address or hostname of an existing node within the cluster you want to join.
Username The user name of the administrator of the target cluster.
Password The password of the administrator of the target cluster.
Services By checking all appropriate check boxes (Data, Index, Query, and Full Text), you can define what kind of services will be provided on the server node that's been added. You can add one, two, or all services.

The node will be created as a new cluster, but the pending status of the node within the new cluster will be indicated on the Cluster Overview page, as shown in the example below:

Add Nodes via UI

To add a new node to an existing cluster after installation, click Add Server within the Manage Server Nodes area of the Couchbase Web Console.

Install and configure Couchbase Server as per the normal setup procedures.

Using the same method, you can add a server that was previously part of this or another cluster. During this process, Couchbase Server must be running.

Enter in the requested information:

Field Description
Server IP Address The IP address or FQDN (Fully Qualified Domain Name) of the server that you want to add. It is preferred that you use FQDNs, especially in a cloud hosting environment.
Username The user name of the administrator account of the node.
Password The password of the administrator account of the node.
Services By checking all appropriate check boxes (Data, Index, Query, and Full Text), you can define what kind of services will be provided on the server node that's been added. You can add one, two, or all services.

A warning will appear indicating that the operation is destructive on the destination server. Any data currently stored on the server will be deleted, and if the server is currently part of another cluster, it will be removed and marked as failed over in that cluster.

Once the information has been entered successfully, the node will be marked as ready to be added to the cluster, and the cluster's pending rebalance count will be updated.

Important: Once a node is added with a specific service, you cannot change the type of service(s) on that node. You must remove the node, rebalance, and then add it back to the cluster with the service(s) of your choice.

Add Nodes via REST API

With the REST API, you can add nodes to the cluster by providing the IP address, administrator username, and password as part of the data payload.

Use the curl command to add a new node. If you are adding another service than data, which is the default, specify that service index or n1ql:
> curl -u cluster-username:cluster-password localhost:8091/controller/addNode\
            -d "hostname=192.168.0.68&user=node-username&password=node-password&services=n1ql"

Add Nodes via CLI

Use CLI to add one or more nodes to an existing cluster.

The new nodes must have Couchbase Server installed, and Couchbase Server must be running on each node.

To add a node:
> couchbase-cli server-add \
            --cluster=localhost:8091  --user cluster-username --password cluster-password \    
            --server-add=192.168.0.72:8091  --server-add-username=node-username \ 
            --server-add-password=node-password \
            --services=data,index,query

where:

Table 1. CLI parameters for adding a node
Parameter Description
--cluster The IP address of a node in the existing cluster.
--user The username for the existing cluster.
--password The password for the existing cluster.
--server-add The IP address of the node to be added to the cluster.
--server-add-username The username of the node to be added.
--server-add-password The password of the node to be added.

If adding was successful, you will see the following response: SUCCESS: server-add 192.168.0.72:8091

If you receive a failure message, you will be notified of the type of failure. You can add multiple nodes in one command by supplying multiple --server-add command-line options to the command.

Note: Once a node has been successfully added, the Couchbase Server cluster indicates that a rebalance is required to complete the operation.
Here’s an example of cluster rebalance after adding a new node: Request syntax with rebalancing:
couchbase-cli rebalance
            -c [localhost]:8091
            --server-add=[host]:8091
            --server-add-username=[administrator]
            --server-add-password=[password]     

You can cancel the addition of a node to a cluster without having to perform a rebalance operation. Canceling the operation removes the server from the cluster without having transferred or exchanged any data, since no rebalance operation took place. You can cancel the operation using the Couchbase Web Console.