Initialize the Cluster

Initialize the Cluster

After completing the installation, your next step is to initialize the cluster. You can initialize the cluster using the Couchbase Web Console, CLI, or REST API. Only Full Administrators can perform the initial Couchbase Server setup.

Initialize the Cluster Using the Web Console

Tip: Clear your browser's cache before starting the setup process. You can find notes and tips on how to do this for different browsers and platforms on www.wikihow.com.

On all platforms you can access the Couchbase Web Console by connecting to the embedded web server on port 8091. For example, if your server can be identified on your network as servera, you can access the Couchbase Web Console by opening http://servera:8091/. You can also use an IP address or, if you are on the same machine, http://localhost:8091. If you set up Couchbase Server on a port other than 8091, go to that specified port.

To set up Couchbase Server with the Couchbase Web Console, click on Setup.

Step 1: Configure Server

As a default, the first setup screen will provide you with a choice to ether start a new cluster or join an existing one.

  1. Start a new cluster

    Stay on the default screen to set up a new cluster. Since the same setting applies to the whole cluster, the same amount of memory will be allocated on each node. Therefore, specify a value that can be supported by all nodes.

    The default value is 60% of your total free RAM and is calculated to provide a RAM capacity for use by the operating system caching layer when accessing and using views.

    For a new cluster, the following setup fields are displayed:
    • RAM Available
    • Services: Select one of the service types for the production environment; select one to three service types for the development environment.
    • Data RAM Quota: 256 MB or more.
    • Full Text RAM Quota: 256 MB more.
    • Index RAM Quota: 256 MB or more.
    • Total Per Server: RAM quota per server represents total RAM used by the data and index services.
    • Index Storage Setting: choose between Standard and Memory-Optimized Global Secondary Indexes.

    If, however, you are joining an existing cluster, click on the radio button Join a cluster now.

    Join a cluster now

    If you are joining a cluster, the following setup fields will be displayed:

    • The IP address of the cluster you are joining.
    • The username of the Couchbase Server administrator who is managing this cluster.
    • The password of the Couchbase Server administrator who is managing this cluster.
    • Services: Select one of the service types for the production environment; select one to three service types for the development environment.
  2. Configure Disk Storage

    For both setup options, configure the disk storage as follows:

    • Database Path: Shows the default location where the database files will be stored:

      /Users/user_name/Library/Application Support/Couchbase/var/lib/couchbase/data.

      and points to the current amount of free space for this location.

    • Indices Path: Shows the default locations where indices will be stored:

      /Users/user_name/Library/Application Support/Couchbase/var/lib/couchbase/data

      and points to the current amount of free space for this location.

    Note: For the production environment, it is recommended to use different file locations.
  3. Configure Server Hostname.
    • Provide a node IP or a hostname. The provided hostname survives node restart.

      For more details about hostnames, see Using Hostnames.

  4. Join Cluster/Start new Cluster The Configure Server Memory section sets the amount of physical RAM that will be allocated by the Couchbase Server for storage.

    If you are creating a new cluster, this is the amount of memory that is allocated on each node within your Couchbase Server cluster. The same amount of memory is allocated to each node in the cluster. Since the same setting applies to the whole cluster, specify a value that can be supported by all nodes. The default value is 60% of your total free RAM and is calculated to provide a RAM capacity for use by the operating system caching layer when accessing and using views.

    • Start a new cluster

      If you select this option, the following setup fields will be displayed:

      • RAM Available
      • Services: Select one of the service types for the production environment; select one or more service types for the development environment.
      • Data RAM Quota: 256 MB or more.
      • Index RAM Quota: 256 MB or more.
      • Full Text RAM Quota: 256 MB or more
      • Total Per Server: RAM quota per server represents total RAM used by the data and index services.
      • Index Storage Setting: Select one of settings: Global Index (default) or Memory-Optimized Global Index (memopt)
    • Join a cluster now:

      If you select this option, the following setup fields will be displayed:

      • The IP address of the cluster you are joining.
      • The username of the Couchbase Server administrator who is managing this cluster.
      • The password of the Couchbase Server administrator who is managing this cluster.
      • Services: Select one of the service types for the production environment; select one to three service types for the development environment.
    • Configure Server Hostname

      For both setup options, configure the hostnames as follows:

      • Provide a node IP or a hostname. The provided hostname survives node restart.

        For more details about hostnames, see Using Hostnames.

    • Click Next.

Step 2: Install Sample Buckets

A screen appears where you can select the sample data buckets you want to install.

  1. Click the names of sample buckets to load to the Couchbase Server. These data sets demonstrate Couchbase Server's features and help you understand and develop views. If you decide to install sample data, the installer creates one Couchbase bucket for each set of sample data you choose.
  2. Click Next.

Step 3: Create default bucket

For the default bucket, look also at the What's this? pop-ups and configure the following:
Bucket Settings
Bucket Name: The name of the Default bucket is pre-set.
Bucket Type: Couchbase (preset) or Memcached
Memory Size
Per Node RAM Quota
Total bucket size
Cache Metadata: Value Ejection (preset) or Full Ejection
Replicas
Enable (preset): select the number of replica backup copies.
View index replicas
Disk I/O Optimization
Set the bucket disk I/O priority: Low (the default) or High.
Flush
Enable
Click Next.

Step 4: Notifications

Update Notifications
Select Update Notifications. The Couchbase Web Console communicates with Couchbase Server nodes and confirms the version numbers of each node.

As long as you have Internet access this information will be sent anonymously to Couchbase corporate, which uses this information only to provide you with updates and information to help improve Couchbase Server and related products. When you provide an email address, it is added to the Couchbase community mailing list for news and update information about Couchbase Server and related products. You can unsubscribe from the mailing list at any time using the Unsubscribe link provided in each newsletter.

Product Registration
Register your product with your information.

Step 5: Configure server

To secure the server, you must create an administrative account and then use these credentials to join other servers and form a cluster.
  1. Provide the administrative credentials: username and password
  2. Click Next.

Couchbase Server is now running and ready to use.

The starting screen for the new Couchbase Server will appear.

Check the installation for example, whether you have properly installed the travel-sample application under Data buckets.

Initialize the Cluster Using the CLI

The following CLI syntax is used to initially set up a single-node Couchbase Server cluster, administrative credentials, port number, add all services, set the RAM quota separately for Data, Index, and Search services, and set the index storage option to memory-optimized global indexes:

couchbase-cli cluster-init OPTIONS:
          --cluster-username=USER //new admin username
          --cluster-password=PASSWORD //new admin password
          --cluster-port=PORT //new cluster REST/http port
          --services=data,index,query,fts //services that server runs 
          --cluster-ramsize=RAMSIZEMB //per node data service ram quota in MB
          --cluster-index-ramsize=RAMSIZEMB //per node index service ram quota in MB
          --cluster-fts-ramsize=RAMSIZEMB //per node index service ram quota in MB
          --index-storage-setting=SETTING //index storage type [default, memopt]

Initialize the Cluster Using the REST API

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

Syntax:
 // Setup Services
            curl -u username=[admin]&password=[password] -v -X POST 
            http://[localhost]:8091/node/controller/setupServices 
            -d services=[data | index | query | fts] 
// Initialize Node 
              curl -v -X POST 
              http://[localhost]:8091/nodes/self/controller/settings 
              -d path=[location] -d index_path=[location]
// Setup Administrator username and password
                curl -v -X POST 
                http://[localhost]:8091/settings/web 
                -d password=[password] -d username=[admin-name]
// Setup Bucket 
                  curl -v -X POST 
                  http://[localhost]:8091/pools/default/buckets 
                  -d ramQuotaMB=[value]  
// Setup Index RAM Quota
                    curl -u username=[admin]&password=[password] -X POST 
                    http://[localhost]:8091/pools/default -d memoryQuota=[value]
                    -d indexMemoryQuota=[value]
Note: Index RAM Quota is set cluster-wide.
Examples:
// Setup Services
            curl -u Administrator:password -v -X POST \
            http://192.168.42.101:8091/node/controller/setupServices \
            -d 'services=kv%2Cn1ql%2Cindex%2Cfts'
// Initialize Node
              curl -v -X POST \
              http://192.168.42.101:8091/nodes/self/controller/settings \ 
              -d 'path=%2Fopt%2Fcouchbase%2Fvar%2Flib%2Fcouchbase%2Fdata&index_path= \
              %2Fopt%2Fcouchbase%2Fvar%2Flib%2Fcouchbase%2Fdata'
// Setup Administrator username and password
                curl -v -X POST \
                http://192.168.42.101:8091/settings/web \ 
                -d 'password=password&username=Administrator&port=SAME'
// Setup Bucket
                  curl -u Administrator:password -v -X POST \
                  http://192.168.42.101:8091/pools/default/buckets \ 
                  -d 'flushEnabled=1&threadsNumber=3&replicaIndex=0&replicaNumber=0&evictionPolicy= \
                  valueOnly&ramQuotaMB=597&bucketType=membase&name=default&authType=sasl&saslPassword='  
// Setup Index RAM Quota
                    curl -u Administrator:password -X POST  \
                    http://127.0.0.1:8091/pools/default \ 
                    -d 'memoryQuota=5000' -d 'indexMemoryQuota=269'