Rebalancing Nodes

Rebalancing Nodes

To start a rebalance process, provide the ejectedNodes and knownNodes parameters. These parameters contain the list of nodes that have been marked to be ejected and the list of nodes that are known within the cluster.

Retrieve information about ejected and known nodes by getting the current node configuration. This ensures that the client making the REST API request is aware of the current cluster configuration. Nodes should have been previously added or marked for removal as appropriate.

HTTP method and URI

The information must be supplied via the ejectedNodes and knownNodes parameters as a POST operation to the /controller/rebalance endpoint.

POST /controller/rebalance      

Syntax

curl -v -X POST -u [admin]:[password] 
  http://[localhost]:8091/controller/rebalance
  [-d ejectedNodes | -d knownNodes]     

Examples

Curl request example for rebalancing new nodes in to a cluster:

curl -v -X POST -u Administrator:password \
'http://192.168.0.77:8091/controller/rebalance'\
-d 'knownNodes=ns_1@192.168.0.77,ns_1@192.168.0.56'

Curl request example for rebalancing nodes out of a cluster:

curl -v -X POST -u Administrator:password \
'http://192.168.0.77:8091/controller/rebalance'\
-d 'ejectedNodes=ns_1@192.168.0.56'

Raw HTTP request example:

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

Response codes

The response is 200 (OK) if the operation was successfully submitted.

If the wrong node information has been submitted, JSON with the mismatch error is returned:

{"mismatch":1}