Create a Cluster

A new Couchbase Server node can be provisioned, to establish its Full Administrator credentials, its service-assignments, and its memory quotas. At this point, it becomes a cluster of one node.

Understanding Provisioning

Provisioning establishes the Full Administrator credentials for the server, and specifies its service-assignments and memory-quota allocations. Provisioning can occur as part of establishing the node as either:

  • The first in a new cluster. Credentials will apply to all other node subsequently added, as will memory allocations. Service-assignments are for this node only.

  • A new member of an existing cluster. Credentials and memory allocations are inherited. Service-assignments are made independently for this node.

Examples on This Page

The examples in the subsections below show how to provision the same node, so that it becomes the first in a new cluster, using the UI, the CLI, and the REST API respectively.

The examples assume that the node has not previously been initialized.

Provision a Node with the UI

The Couchbase Web Console is, by default, available on port 8091. Therefore, if your machine can be identified on the network as servera, you can access the Couchbase Web Console by opening http://servera:8091/. Alternatively, you can use an IP address or, if you are working on the machine on which installation was performed, http://localhost:8091. If you have chosen to run Couchbase Server on a port other than 8091, connect on that specific port.

Once you have connected, the Welcome screen appears:

welcome

The Welcome screen lets you either Setup New Cluster, or Join Existing Cluster. Information on joining an existing cluster is provided in Join a Cluster and Rebalance. To set up a new cluster, left-click on Setup New Cluster.

Set Up a New Cluster

The New Cluster screen now appears, as follows:

setUpNewCluster01

The fields displayed on the screen are:

  • Cluster Name: Your choice of name for the cluster to be created.

  • Create Admin Username: Your choice of username, for yourself: the Full Administrator for this cluster. You will have read-write access to all Couchbase Server resources; including the ability to create new users with defined roles and corresponding privileges.

    Note that Couchbase Server prohibits use of the following characters in usernames: ( ) < > @ , ; : \ " / [ ] ? = { }. Usernames may not be more than 128 UTF-8 characters in length; and it is recommended that they be no more than 64 UTF-8 characters in length, in order to ensure successful onscreen display.

  • Your choice of password, for yourself: the Full Administrator for this cluster. The only default format-requirement is that the password be at least 6 characters in length. However, following cluster-initialization, you can modify (and indeed strengthen) the default password-policy, by means of the Couchbase CLI setting-password-policy command.

When you have entered appropriate data into each field, left-click on the Next: Accept Terms button, at the lower right.

Accept Terms

The New Cluster screen now changes, to show the Terms and Conditions for the Enterprise Edition of Couchbase Server:

TsAndCs01

Check the I accept the terms & conditions checkbox. Then, to register for updates, left-click on the right-facing arrowhead, adjacent to the Register for updates notification. The screen now expands vertically, as follows:

registerForUpdates01

To receive updates, fill out the four newly displayed fields with your first and last name, company-name, and email-address. Provided that the current node is connected to the internet, the Couchbase Server version-numbers corresponding to each node in your cluster will be anonymously sent to Couchbase: this information is used by Couchbase over time, to provide you with appropriate updates, and to help with product-improvement. Your email-address will be added to the Couchbase community mailing-list, so that you can periodically receive Couchbase news and product-information. (You can unsubscribe from the mailing-list at any time using the Unsubscribe link, provided in each newsletter.)

You now have two options for proceeding. If you left-click on the Finish With Defaults button, cluster-initialization is performed with default settings, provided by Couchbase; the Couchbase Web Console Dashboard appears, and your configuration is complete. However, if you wish to customize those settings, left-click on the Configure Disk, Memory, Services button, and proceed as follows.

Configure Couchbase Server

The Configure screen now appears, as follows:

configureNewCluster01

The displayed fields are:

  • Host Name/IP Address: Enter the hostname or IP address for the machine on which you are configuring Couchbase Server.

  • Data Disk Path: Enter the location on the current node where the database files will be stored. An OS-specific default is provided: here, for MacOS, this is /Users/username/Library/Application Support/Couchbase/var/lib/couchbase/data. The read-only Free field shows the current amount of free space for this location.

  • Indexes Disk Path: Enter the location on the current node where indexes will be stored. An OS-specific default is provided: here, for MacOS, this is: /Users/username/Library/Application Support/Couchbase/var/lib/couchbase/data. The read-only Free field shows the current amount of free space for this location.

    Note that for a production environment, it is recommended that data and indexes should not share the same location.

  • Analytics Disk Paths: Enter the location on the current node where indices will be stored. An OS-specific default is provided: here, for MacOS, this is /Users/username/Library/Application Support/Couchbase/var/lib/couchbase/data. The read-only Free field shows the current amount of free space for this location.

    You can enter more than one location to store Analytics data. Click + to specify an additional location for Analytics data, or click - to remove a location.

  • Java Runtime Path: If desired, enter the location for an alternative Java Runtime Environment (JRE) on the current node that you want to use for the Analytics Service.

    Couchbase Server is supplied with the Oracle Java 8 JRE. If no location is specified, the supplied JRE is used.

  • Service Memory Quotas: A series of fields that allows you to specify how much memory should be allocated to each service you select for both the current node and for each node you may subsequently add to the cluster. Each service can be selected by checking a checkbox, and then specifying the total number of megabytes to be assigned to the service. In each case, a memory quota is suggested, and a minimum quota is required. The sum of all quotas must be within the total amount of available RAM for the current node.

    • Data Service: Since you are starting a new cluster, the Data service (which is essential for the cluster) has been allocated with its checkbox disabled. If this is a development system, you may add up to three services. Note that on a production system, it is recommended that only one service ever be allocated per node.

    • Index Service: Selection and RAM-allocation to support Global Secondary Indexes. This should be 256 MB or more. If this service is selected, a default quota is provided.

    • Search Service: Selection and RAM-allocation for the Full Text Service. This should be 256 MB or more. If this service is selected, a default quota is provided.

    • Analytics Service: Selection and RAM-allocation for the Analytics Service. By default, this service appears unselected. The memory quota should be 1024 MB or more. If this service is selected, a default quota is provided.

    • Query Service: No RAM-allocation is required for this service.

    • Eventing Service: Selection and RAM-allocation for the Eventing Service. The memory quota should be 256 MB or more. If this service is selected, a default quota is provided.

    The total memory quota you have allocated is displayed below these fields, towards the right. The total RAM available is displayed below this figure, at the center. If your memory allocation is excessive, a notification warns you, and you must lessen your allocation.

  • Index Storage Setting: If the Index Service has been selected, either Standard Global Secondary Indexes or Memory-Optimized Global Secondary Indexes can be chosen here, by means of radio buttons. See Global Secondary Indexes, for details.

When you have finished entering your configuration-details, left-click on the Save & Finish button, at the lower right. This configures the server accordingly, and brings up the Couchbase Web Console Dashboard, for the first time.

dashboard01

New-Cluster Set-Up: Next Steps

If this is the first server in the cluster, a notification appears, stating that no buckets are currently defined. A bucket is the principal unit of data-storage used by Couchbase Server. In order to save and subsequently access documents and other objects, you must create one or more buckets.

As specified by the notification, you can go to Buckets, and begin bucket-creation; or add a sample bucket: left-click on the links provided. A description of how to create, edit, flush, and delete buckets can be found in the section Manage Buckets. An architectural description of buckets can be found in the section Buckets. (There are three different kinds of bucket, so you may wish to familiarize yourself with their properties, before you start bucket-creation.) Note that sample buckets already contain data, and so are ready for your immediate experimentation and testing.

The buckets that you create must be accessed securely: therefore, Couchbase Server provides a system of Role-Based Access Control (RBAC), which must be used by administrators and applications that wish to access buckets. Each administrator and application is considered to be a user, and must perform bucket-access by passing a username and password. For information on how to set up RBAC users so that they can access the buckets you create, see Authorization.

Provision a Node with the CLI

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

couchbase-cli cluster-init -c 10.142.181.101 \
--cluster-username Administrator \
--cluster-password password \
--services data,index,query \
--cluster-ramsize 512 \
--cluster-index-ramsize 256

This provisions node 10.142.181.101 with the Full Administrator username and password, and establishes three services. It also specifies memory quotas for Data and Index services.

If the node is successfully provisioned, it is thereby initialized as a cluster. The following output is displayed:

SUCCESS: Cluster initialized

Note that the default disk-paths for data, indexes, and analytics will be used, since no custom paths were specified by means of the node-init command (see Initialize a Node with the CLI.)

For more information, including additional flags that can be specified, see the command reference for node-init.

Provision a Node with the REST API

The following REST API examples set up a single-node Couchbase Server cluster with three services, administrative credentials, and a RAM quota. The following methods are used:

  • /node/controller/setupServices: Allows services to be assigned, by means of the services flag. Values can be kv (Data Service), index (Index Service), n1ql (Query Service), fts (Search Service), and cbas (Analytics Service). For the complete reference, see * /pools/default: Allows memory quotas to be specified.

  • /settings/web: Allows Full Administrator username and password to be specified. Requires the REST API port to be specified also, with SAME accepted as the default.

For complete references, see Creating a New Cluster.

Enter the following, to provision a node with Data, Query, and Index services; to establish quotas for Data Service and Index Service, and to establish Full Administrator credentials.

curl  -v -X POST http://10.142.181.101:8091/node/controller/setupServices \
-d 'services=kv%2Cn1ql%2Cindex'

curl  -v -X POST http://10.142.181.101:8091/pools/default \
-d 'memoryQuota=256' \
-d 'indexMemoryQuota=256'

curl  -u Administrator:password -v -X POST \
http://10.142.181.101:8091/settings/web \
-d 'password=password&username=Administrator&port=SAME'

The last command, which establishes credentials, completes provisioning. The following output is provided:

{"newBaseUri":"http://10.142.181.101:8091/"}

The provisioned node has thus been initialized as a cluster, and is available at the given IP address and port number. Note that the default disk-paths for data, indexes, and analytics will be used, since no custom paths were specified by means of /nodes/self/controller/settings (see Initialize a Node with the REST API.)

Next Steps

Following provisioning, a Couchbase Server node constitutes a Couchbase Cluster of one node. From this point, additional nodes can be added to the cluster. See Add a Node and Rebalance, for details.