A newer version of this documentation is available.

View Latest

Initialize a Node

      +
      A new Couchbase Server node can be initialized, to establish node-specific paths for local storage.

      Understanding Initialization

      Following installation and start-up of Couchbase Server, a node must be:

      • Initialized, whereby its disk-paths for data, indexes, analytics, and eventing can be established.

      • Provisioned, whereby all other details, including Full Administrator credentials, service assignments, and memory quota-definitions are established.

      Optionally, initialization can be performed explicitly and independently of provisioning, as a prior process, in order to establish custom disk-paths. When the node is subsequently provisioned, these are preserved (unless, as is possible with UI-based provisioning, they are optionally overwritten, and the node is thus re-initialized).

      If initialization is not explicitly performed, it will occur as part of the eventual provisioning process, and default disk-path values will be applied.

      Note that disk-paths cannot be changed after a node has been provisioned, and has thus either become a cluster of one node, or has been added to a cluster of other nodes.

      Examples on This Page

      The examples in the subsections below show how to initialize the same node; using the CLI, and the REST API respectively. Note that UI-based initialization only be performed as part of the overall provisioning process.

      The examples assume:

      • Couchbase Server has been installed and started.

      • The IP address of the node is 10.142.181.103.

      Initialize a Node with the CLI

      To initialize a node with the CLI, use the node-init command, as follows:

      couchbase-cli node-init -c 10.142.181.103 \
      -u placeholdername -p placeholderpwd \
      --node-init-data-path /opt/couchbase/var/lib/couchbase/data \
      --node-init-index-path /opt/couchbase/var/lib/couchbase/data \
      --node-init-eventing-path /opt/couchbase/var/lib/couchbase/data \
      --node-init-analytics-path /opt/couchbase/var/lib/couchbase/data \
      --node-init-hostname node1-devcluster.com \
      --ipv4

      This initializes the disk-paths for data, indexes, eventing, and analytics on node 10.142.181.103 to the values shown. Note that the command requires that a username and password be specified, although the node has not yet been provisioned with credentials. Placeholders are therefore provided: these can be overwritten during subsequent provisioning. The command additionally specifies IPv4 as the address family for the node, and assigns the node a hostname of node1-devcluster.com. To specify IPv6, use the --ipv6 flag instead.

      If successful, the operation returns the following:

      SUCCESS: Node initialized

      For more information, see the reference for the node-init command.

      Initialize a Node with the REST API

      To initialize a node with the REST API, use the POST /nodes/self/controller/settings http method and URI, as follows:

      curl  -u Administrator:password -v -X POST \
        http://10.142.181.103:8091/nodes/self/controller/settings \
        -d 'path=%2Fopt%2Fcouchbase%2Fvar%2Flib%2Fcouchbase%2Fdata&' \
        -d 'index_path=%2Fopt%2Fcouchbase%2Fvar%2Flib%2Fcouchbase%2Fidata&' \
        -d 'cbas_path=%2Fopt%2Fcouchbase%2Fvar%2Flib%2Fcouchbase%2Fadata&' \
        -d 'eventing_path=%2Fopt%2Fcouchbase%2Fvar%2Flib%2Fcouchbase%2Fedata&'

      This initializes the disk-paths for data, indexes, analytics, and eventing on node 10.142.181.103 to the values shown.

      For more information on /nodes/self/controller/settings, see Creating a New Cluster.

      Note that to assign a name to the node, the POST /node/controller/rename http method and URI can be used, as follows:

      curl -v -X POST -u Administrator:password \
      http://10.143.192.103:8091/node/controller/rename \
      -d hostname=node1-devcluster.com

      The assigns the name node1-devcluster.com to the node.

      Next Steps

      Following initialization, a node can be provisioned so as to become a Couchbase Cluster of one node. See Create a Cluster for details.