Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Cluster REST API uses the PUT /api/cluster/flexup and flex downflexdown HTTP method and URI to expand and shrink the cluster size size.

HTTP Method and URI

Code Block
PUT /api/cluster/flexup      // Expands the size of the YARN cluster.

PUT /api/cluster/flexdown    // Shrinks the size of the YARN cluster.

...

Parameters include:

ParameterDescription
profileValue

(Required) If a profile value is not specified, the API returns an error. The profile indicates the amount of resources (CPU or memory) a Node Manager should advertise to the Resource Manager. Default profiles: zero, small, medium, large.

Default: zero. The instance size in the cluster is

These default profiles (zero, small, medium, and large) are defined in the myriad-config-default.yml file. The resources associated with these default profiles can be modified; additionally, new profiles can be defined.

instancesValue: one

(

1) to the number of nodes in the cluster. For example, if there are 100 nodes in your cluster, you are bound by 100. If you specify more than 100, the excess is place in a pending state.
constraintsValue: ??. Hostnames are used to define cluster boundary and to start and stop Node Managers on a predefined set of nodes.

...

Required) The number of Node Managers instances to launch. Each Node Manager instance advertises the amount of resources specified in the profile. The value is a number in the range of zero (0) to the number of Mesos slave nodes.

constraints(Optional) Array definition for a single constraint using the LIKE operator constraint format: <mesos_slave_attribute|hostname> LIKE <value_regex>. The hostname constraint is used to launch Node Managerss on nodes whose hostname matches the regex passed in as value. See common Mesos slave attributes (http://mesos.apache.org/documentation/attributes-resources) for more information.

 

Syntax

Code Block
<localhost><resource_manager_host>:8192/api/cluster/flexup
<localhost>
	profile=<zero|small|medium|large>
	instances=<integer>
	constraints=<["JSON array of strings"]>
<resource_manager_host>:8192/api/cluster/flexdown
	profile=<zero|small|medium|large>
	instances=<integer>
	constraints=<["JSON array of strings"]>

 

Request Examples

Curl request example to flexup two instances with the profile set to small:

Code Block
curl -X PUT http://10.10.100.19:8192/api/cluster/flexup 
	-d instances=2 
	-d profile=small

 

Curl request example to flexdown one instance with the profile set to small:

Code Block
curl -X PUT http://10.10.100.19:8192/api/cluster/flexdown 
	flexup -d instances=1 
	-d profile=small

 

Curl request example to launch two (2) Node Managers with profile set to large only on specific hosts, host-120 through host-129:

Code Block
curl -X PUT http://10.10.100.19:8192/api/cluster/flexdown 
	-d instances=2 
	-d profile=smalllarge 
	-d constraints=["hostname LIKE host-12[0-9].example.com"]
 

Request header to flexdown requestflexup:

Code Block
PUT /api/cluster/flexdownflexup HTTP/1.1
Host: 10.10.100.19:8192
Connection: keep-alive
Content-Length: 1736
Origin: http://10.10.100.19:8192
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36
Content-Type: application/json
Accept: */*
Referer: http://10.10.100.19:8192/
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8

 

Request header to flexupflexdown:

Code Block
PUT /api/cluster/flexupflexdown HTTP/1.1
Host: 10.10.100.19:8192
Connection: keep-alive
Content-Length: 3617
Origin: http://10.10.100.19:8192
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36
Content-Type: application/json
Accept: */*
Referer: http://10.10.100.19:8192/
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8

...

Code Block
{profile: "medium", instances: "1"}

 

Launches a Node Manager with the profile set to small on any host in the Mesos cluster:

...

Launches four (4) Node Managers with profile set to large only on specific hosts, host-120 through host-129:

Code Block
{
	"instances":4, 
	"profile": "large", 
	"constraints": ["hostname LIKE host-12[0-9].example.com"]
}

Launches two (2) Node Managers with profile set to zero only on hosts sharing a common Mesos slave attribute (http://mesos.apache.org/documentation/attributes-resources):

Code Block
{
	"instances":2, 
	"profile": "zero", 
	"constraints": ["hdfs LIKE true"]
}

 

 

 

...

 

Response Example

Code Block
202 ACCEPTED