• MapReduce Service

mrs
  1. Help Center
  2. MapReduce Service
  3. API Reference
  4. APIs
  5. Cluster Management APIs
  6. Resizing Nodes to a Cluster

Resizing Nodes to a Cluster

Function

This API is used to resize Core nodes or Task nodes to a cluster. This API is incompatible with Sahara.

Capacity expansion or capacity reduction is allowed only for clusters in the running state.

URI

  • Format:

    PUT /v1.1/{project_id}/cluster_infos/{cluster_id}

  • Parameter description
    Table 1 URI parameter description

    Parameter

    Mandatory or Not

    Description

    project_id

    Yes

    Project ID. For details on how to obtain the project ID, see Obtaining a Project ID.

    cluster_id

    Yes

    Cluster ID

Request

  • Example:

    Adding Core nodes:

    {
        "service_id": "", 
        "plan_id": "", 
        "parameters": {
            "order_id": "", 
            "scale_type": "scale_out", 
            "node_id": "node_orderadd", 
            "node_group": "core_node_default_group",
            "instances": "1" 
           "skip_bootstrap_scripts":false
        }, 
        "previous_values": {
            "plan_id": ""
        }
    }

    Adding Task nodes when the number of the existing Task nodes is greater than zero:

    { 
        "service_id": "",  
        "plan_id": "",  
        "parameters": { 
            "order_id": "",  
            "scale_type": "scale_out",  
            "node_id": "node_orderadd",  
            "node_group": "task_node_default_group",
            "instances": "1"  
            "skip_bootstrap_scripts":false  
     
        },  
        "previous_values": { 
            "plan_id": "" 
        } 
    }

    Adding Task nodes when the number of the existing Task nodes is zero:

    { 
        "service_id": "",  
        "plan_id": "",  
        "parameters": { 
            "order_id": "",  
            "scale_type": "scale_out",  
            "node_id": "node_orderadd",  
            "node_group": "task_node_default_group",
            "task_node_info": {
                  "node_size": "s1.xlarge.linux.mrs",
                  "data_volume_type":"SATA",
                  "data_volume_count":2,
                  "data_volume_size":200
                   },
    
            "instances": "1"  
     
        },  
        "previous_values": { 
            "plan_id": "" 
        } 
    }

    Deleting Core nodes:

    { 
        "service_id": "",  
        "plan_id": "",  
        "parameters": { 
            "order_id": "",  
            "scale_type": "scale_in",  
            "node_id": "node_orderadd",  
            "node_group": "core_node_default_group",
            "instances": "1"  
     
        },  
        "previous_values": { 
            "plan_id": "" 
        } 
    }

    Deleting Task nodes:

    { 
        "service_id": "",  
        "plan_id": "",  
        "parameters": { 
            "order_id": "",  
            "scale_type": "scale_in",  
            "node_id": "node_orderadd",  
            "node_group": "task_node_default_group",
            "instances": "1"  
     
        },  
        "previous_values": { 
            "plan_id": "" 
        } 
    }
  • Parameter description
    Table 2 Request parameter description

    Parameter

    Mandatory or Not

    Type

    Description

    service_id

    No

    String

    Service ID

    Reserve the parameter for expanding APIs. The user does not need to configure the parameter.

    plan_id

    No

    String

    Plan ID

    Reserve the parameter for expanding APIs. The user does not need to configure the parameter.

    parameters

    order_id

    Yes

    String

    The order ID that is obtained by the system when the node is added or deleted. The user does not need to configure the parameter.

    scale_type

    Yes

    String

    • scale_in: cluster shrink
    • scale_out: cluster expansion

    node_id

    Yes

    String

    ID of the newly added or deleted node. The parameter value is fixed to node_orderadd. An ID of the newly added or deleted node includes node_orderadd, for example, node-orderadd-TBvSr.com.

    node_group

    No

    String

    Node group needing capacity expansion or reduction
    • If node_group is core_node_default_group, it indicates a Core node group.
    • If node_group is task_node_default_group, it indicates a Task node group.

    If you leave this parameter blank, the default value is core_node_default_group.

    task_node_info

    No

    Object

    Task node specifications. For details, see Table 3.

    • When the number of Task nodes is 0, this parameter is used to specify Task node specifications.
    • When the number of Task nodes is greater than 0, this parameter is unavailable.

    instances

    Yes

    String/Integer

    Number of nodes to be added or deleted

    • The maximum number of nodes to be added is 500 minus the number of cluster Core nodes and Task nodes. For example, the current number of cluster Core nodes is 3, the number of nodes to be added must be less than or equal to 497.

      A maximum of 500 Core nodes and Task nodes are supported by default. If more than 500 Core nodes or Task nodes are required, contact technical support engineers or invoke a background interface to modify the database.

    • Nodes can be deleted for capacity reduction when the number of Core nodes is greater than 3 or the number of Task nodes is greater than 0. For example, if there are 5 Core nodes and 5 Task nodes in a cluster, only 2 (5 minus 3) Core nodes are available for deletion while 5 or fewer than 5 Task nodes can be deleted.

    skip_bootstrap_scripts

    No

    Boolean

    This parameter is valid only when a bootstrap action is configured during cluster creation and is meaningful during capacity expansion. It indicates whether the bootstrap action specified during cluster creation is performed on nodes added during capacity expansion. The default value is false, indicating that the bootstrap action is performed.

    MRS 1.7.2 or later supports this parameter.

    previous_values

    plan_id

    No

    String

    Reserve the parameter for expanding APIs. The user does not need to configure the parameter.

    Table 3 task_node_info parameter description

    Parameter

    Mandatory or Not

    Type

    Description

    node_size

    Yes

    String

    Instance specifications of the Task node

    data_volume_type

    Yes

    String

    Storage type of data disks of the Task node. Currently, SATA, SAS, and SSD are supported.

    • SATA: Common I/O
    • SAS: High I/O
    • SSD: Ultra-high I/O

    data_volume_count

    Yes

    Integer

    Number of data disks of the Task node

    Value range: 1 to 10

    data_volume_size

    Yes

    Integer

    Storage space of data disks of the Task node

    Value range: 100 GB to 32000 GB

Response

  • Example:
    {
        "result": "succeeded"
    }
  • Parameter description
    Table 4 Response parameter description

    Parameter

    Mandatory or Not

    Type

    Description

    result

    Yes

    String

    Operation result

    • succeeded: operation succeeded
    • Table 5 describes the error codes returned upon operation failures.

    The following table lists the error codes that may be returned if capacity expansion fails.

    Table 5 Error code

    Error Code

    Message

    12000002

    The parameter is invalid.

    12000003

    The cluster does not exist.

    12000009

    The method parameter is invalid.

    12000013

    Reducing the capacity for the XX cluster failed.

    12000014

    Expanding the capacity for the XX cluster failed.

    12000017

    Capacity expansion/reduction is not allowed for clusters that are not in the [Running] state.

    12000018

    The cluster capacity is being expanded/reduced. New capacity expansion/reduction operations on the cluster are not allowed.

    12000028

    The cluster has a maximum of N Core nodes.

    12000029

    Obtaining the quota failed.

    12000030

    The number of nodes in the cluster exceeds the available quota.

    12000031

    The number of CPU cores in the cluster exceeds the available quota.

    12000032

    The total memory of the cluster exceeds the available quota.

    12000033

    The number of disks in the cluster exceeds the available quota.

    12000034

    The total disk capacity of the cluster exceeds the available quota.

    12000054

    The operation is not supported.

    MRS.101

    Insufficient quota to meet your request. Contact customer service to increase the quota.

    MRS.102

    The token cannot be null or invalid. Try again later or contact customer service.

    MRS.103

    Invalid request. Try again later or contact customer service.

    MRS.104

    Insufficient resources. Try again later or contact customer service.

    MRS.105

    Insufficient IP addresses in the existing subnet. Try again later or contact customer service.

    MRS.201

    Failed due to an ECS error. Try again later or contact customer service.

    MRS.202

    Failed due to an IAM error. Try again later or contact customer service.

    MRS.203

    Failed due to a VPC error. Try again later or contact customer service.

    MRS.300

    MRS system error. Try again later or contact customer service.

Status Code

Table 6 describes the status code of this API.

Table 6 Status code

Status Code

Description

200

The Core or Task nodes are successfully added or deleted.

For the description about error status codes, see section Status Codes.