To start a rebalance process through the REST API you must supply two arguments containing the list of nodes that have been marked to be ejected, and the list of nodes that are known within the cluster. You can obtain this information by getting the current node configuration from Section 8.5, “Managing Couchbase Nodes”. This is to ensure that the client making the REST API request is aeare of the current cluster configuration. Nodes should have been previously added or marked for removal as appropriate.
The information must be supplied via the
ejectedNodes and knownNodes
parameters as a POST operation to the
/controller/rebalance endpoint. For
example:
shell> curl -v -X -u admin:password POST 'http://Administrator:Password@192.168.0.77:8091/controller/rebalance' \ -d 'ejectedNodes=&knownNodes=ns_1%40192.168.0.77%2Cns_1%40192.168.0.56'
The corresponding raw HTTP request:
POST /controller/rebalance HTTP/1.1 Authorization: Basic QWRtaW5pc3RyYXRvcjpUYW1zaW4= User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5 Host: 192.168.0.77:8091 Accept: */* Content-Length: 63 Content-Type: application/x-www-form-urlencoded
The response will be 200 (OK) if the operation was successfully submitted.
If the wrong node information has been submitted, JSON with the mismatch error will be returned:
{"mismatch":1}Progress of the rebalance operation can be obtained by using Section 8.7.6, “Getting Rebalance Progress”.