A newer version of this documentation is available.

View Latest

Initial Server Setup with CLI or REST API

You can initialize and configure a new Couchbase Server node using CLI and REST API commands.

Using CLI

The following CLI syntax is used to initially set up a single-node Couchbase Server cluster, administrative credentials, port number, RAM quota separately for the Index service and the Data service, and to add services:

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
--cluster-ramsize=RAMSIZEMB //per node data service ram quota in MB
--cluster-index-ramsize=RAMSIZEMB //per node index service ram quota in MB
--services=data,index,query,moxi //services that server runs

Using 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]
// 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]
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'
// 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'