Creating a new cluster
- reference
Clusters are created by setting up a cluster with an initial Couchbase Server node.
Syntax
Curl example syntax:
// Initialize Node curl -u Administrator:password -v -X POST http://[localhost]:8091/nodes/self/controller/settings -d path=[location] -d index_path=[location] -d cbas_path=[location] -d eventing_path=[location] // Rename Node curl -u Administrator:password -v -X POST http://[localhost]:8091/node/controller/rename -d hostname=[localhost] // Setup Services curl -u Administrator:password -v -X POST http://[localhost]:8091/node/controller/setupServices -d services=[kv | index | n1ql | fts | cbas | eventing | backup] // Set Memory Quotas curl -u Administrator:password -v -X POST http://[localhost]:8091/pools/default -d memoryQuota=[value] -d indexMemoryQuota=[value] -d ftsMemoryQuota=[value] -d cbasMemoryQuota=[value] -d eventingMemoryQuota=[value] // Setup Administrator username and password curl -u Administrator:password -v -X POST http://[localhost]:8091/settings/web -d password=[password] -d username=[admin-name] -d port=8091 // Setup Bucket curl -u Administrator:password -v -X POST http://[localhost]:8091/pools/default/buckets -d flushEnabled=[1 | 0] -d replicaNumber=[0 - n] -d evictionPolicy=[valueOnly | full] -d ramQuotaMB=[value] -d bucketType=[membase | couchbase] -d name=[bucket-name]
Description
Whether adding a node to an existing cluster or starting a new cluster, the node’s disk path must be configured. The next steps depends on whether a new cluster is created or a node is added to an existing cluster. When creating a new cluster, secure it by providing an administrative username and password. When adding a node to an existing cluster, obtain the URI and credentials to use the REST API with that cluster. Before assigning a name to the node, read the information provided in Naming Clusters and Nodes.
The following is the procedure for creating a new cluster:
-
Initialize the node
-
Rename the node
-
Set up the Couchbase Server services
-
Set memory quotas
-
Establish the administrator name and password
-
Setup bucket parameters
HTTP method and URI
The following HTTP method and URI endpoints are used for this provisioning procedure:
POST /nodes/self/controller/settings POST /node/controller/rename POST /node/controller/setupServices POST /pools/default POST /settings/web POST /pools/default/buckets
Examples
Curl examples:
// Initialize Node curl -u Administrator:password -v -X POST \ http://192.168.42.101:8091/nodes/self/controller/settings \ -d 'path=%2Fopt%2Fcouchbase%2Fvar%2Flib%2Fcouchbase%2Fdata&' \ -d 'index_path=%2Fopt%2Fcouchbase%2Fvar%2Flib%2Fcouchbase%2Fdata&' \ -d 'cbas_path=%2Fopt%2Fcouchbase%2Fvar%2Flib%2Fcouchbase%2Fdata&' \ -d 'eventing_path=%2Fopt%2Fcouchbase%2Fvar%2Flib%2Fcouchbase%2Fdata&' // Rename Cluster curl -u Administrator:password -v -X POST http://192.168.42.101:8091/node/controller/rename \ -d 'hostname=127.0.0.1' // Setup Services curl -u Administrator:password -v -X POST http://192.168.42.101:8091/node/controller/setupServices \ -d 'services=kv%2Cn1ql%2Cindex%2Cfts' // Setup Memory Quotas curl -u Administrator:password -v -X POST http://192.168.42.101:8091/pools/default \ -d 'memoryQuota=256' \ -d 'indexMemoryQuota=256' \ -d 'ftsMemoryQuota=256' // Setup Administrator username and password curl -u Administrator:password -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'
Note: Service name for query service is different in REST APIs and CLI. REST API uses "n1ql" as the service name while CLI uses "query" in the services settings.