Updated on 2024-09-30 GMT+08:00

Resizing a Cluster

Function

This API is used to scale out or scale in Core or Task nodes in a cluster that has been created. After an MRS cluster is created, the number of Master nodes cannot be adjusted. That is, Master nodes cannot be scaled in or out. This API is incompatible with Sahara.

Only clusters in the Running state can be scaled out or in.

The APIs described in this section support only streaming, analysis, and hybrid clusters.

Constraints

None

Debugging

You can debug this API in API Explorer. Automatic authentication is supported. API Explorer can automatically generate sample SDK code and provide the sample SDK code debugging.

URI

  • Format

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

  • Parameter description
    Table 1 URI parameters

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Explanation

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

    Constraints

    N/A

    Value range

    The value must consist of 1 to 64 characters. Only letters and digits are allowed.

    Default value

    N/A

    cluster_id

    Yes

    String

    Explanation

    Cluster ID If this parameter is specified, the latest metadata of the cluster that has been patched will be obtained. For details about how to obtain the cluster ID, see Obtaining a Cluster ID.

    Constraints

    N/A

    Value range

    The value can contain 1 to 64 characters, including only letters, digits, underscores (_), and hyphens (-).

    Default value

    N/A

Request Parameters

Table 2 Request parameters

Parameter

Mandatory

Type

Description

service_id

No

String

Explanation

Service ID. This parameter is reserved for extension. You do not need to set this parameter.

Constraints

N/A

Value range

N/A

Default value

N/A

plan_id

No

String

Explanation

Plan ID. This parameter is reserved for extension. You do not need to set this parameter.

Constraints

N/A

Value range

N/A

Default value

N/A

parameters

Yes

ClusterScalingParams object

Explanation

Request parameters. For details, see Table 3.

Constraints

N/A

previous_values

No

Map<String,String>

Explanation

This parameter is an extended API and needs to be reserved. You do not need to set this parameter.

Constraints

N/A

Table 3 ClusterScalingParams

Parameter

Mandatory

Type

Description

order_id

No

String

Explanation

Order ID obtained by the system during scale-out or scale-in. You do not need to set the parameter.

Constraints

N/A

Value range

N/A

Default value

N/A

scale_type

Yes

String

Explanation

Operation type on the cluster node.

Constraints

N/A

Value range

  • scale_in: cluster scale-in
  • scale_out: cluster scale-out

Default value

N/A

node_id

Yes

String

Explanation

ID of the newly added or removed node. The parameter value is fixed to node_orderadd.

Constraints

N/A

Value range

N/A

Default value

N/A

node_group

No

String

Explanation

Node group to be scaled out or in

Constraints

N/A

Value range

  • core_node_default_group: indicates the Core node group.
  • task_node_default_group: indicates the Task node group.

Default value

core_node_default_group

task_node_info

No

Object

Explanation

Task node specifications. For more parameter description, see Table 4.

Constraints

  • 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. If this parameter is left blank, its mandatory field becomes unavailable and will pass an empty button for the null object.

instances

Yes

Integer

Explanation

Number of nodes to be added or removed

Constraints

  • The maximum number of nodes to be added is 500 minus the number of Core and Task nodes. For example, the current number of Core nodes is 3, the number of nodes to be added must be less than or equal to 497.
  • A maximum of 500 Core and Task nodes are supported by default. If more than 500 Core and Task nodes are required, contact technical support engineers or call a background API to modify the database.
  • Nodes can be deleted for cluster scale-out 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 and 5 or fewer than 5 Task nodes can be deleted.

Value range

≥1

Default value

N/A

skip_bootstrap_scripts

No

String

Explanation

Whether to skip the bootstrap action. This parameter is valid only when a bootstrap action is configured during cluster creation and takes effect during scale-out. It indicates whether the bootstrap action specified during cluster creation is performed on nodes added during scale-out.

Constraints

N/A

Value range

  • true: Skip the bootstrap action.
  • false: Execute the bootstrap action.

Default value

false

scale_without_start

No

Boolean

Explanation

Whether to start components on the added nodes after cluster scale-out

Constraints

N/A

Value range

  • true: Do not start components after scale-out.
  • false: Start components after scale-out.

Default value

N/A

server_ids

No

Array of strings

Explanation

ID list of Task nodes to be deleted during task node scale-in.

Constraints

  • This parameter does not take effect when scale_type is set to scale-out.
  • If scale_type is set to scale-in and cannot be left blank, the system deletes the specified Task nodes.
  • When scale_type is set to scale-in and server_ids is left blank, the system automatically deletes the Task nodes based on the system rules.
Table 4 task_node_info parameters

Parameter

Mandatory

Type

Description

node_size

Yes

String

Explanation

Instance specifications of a Task node, for example, c3.4xlarge.2.linux.bigdata. For details about instance specifications, see ECS Specifications Used by MRS and BMS Specifications Used by MRS. You are advised to obtain the specifications supported by the corresponding version in the corresponding region from the cluster creation page on the MRS console.

Constraints

N/A

Value range

N/A

Default value

N/A

data_volume_type

Yes

String

Explanation

Data disk storage type of the Task node. Supported types include SATA, SAS, and SSD.

Constraints

N/A

Value range

  • SATA: common I/O
  • SAS: high I/O
  • SSD: ultra-high I/O
  • GPSSD: general-purpose SSD

Default value

N/A

data_volume_count

Yes

Integer

Explanation

Number of data disks of a Task node.

Constraints

N/A

Value range

0-20

Default value

N/A

data_volume_size

Yes

Integer

Explanation

Data disk storage space of a Task node. You only need to pass in a number without the unit GB.

Constraints

N/A

Value range

100-32000

Default value

N/A

Response Parameters

Table 5 describes the response parameter.
Table 5 Response parameter

Parameter

Type

Description

result

String

Explanation

Operation result

Value range

  • succeeded: The operation is successful.
  • Error Codes describes the error codes returned upon operation failures.

Example Request

  • Add one core node to the MRS cluster.
    PUT /v1.1/{project_id}/cluster_infos/{cluster_id}
    
    { 
        "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,
           "scale_without_start":false
        },  
        "previous_values": { }
    }
  • If the number of Task nodes is greater than 0, add one Task node to the MRS cluster.
    PUT /v1.1/{project_id}/cluster_infos/{cluster_id}
    
    { 
        "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,  
            "scale_without_start":false
        },  
        "previous_values": { }
    }
  • If the number of Task nodes is greater than 0, add a Task node of the s3.xlarge.2.linux.bigdata specification to the MRS cluster.
    PUT /v1.1/{project_id}/cluster_infos/{cluster_id}
    
    { 
        "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": "s3.xlarge.2.linux.bigdata",
                      "data_volume_type":"SATA",
                      "data_volume_count":2,
                      "data_volume_size":600
                      },
            "instances": "1",  
            "scale_without_start":false
    
    
        },  
        "previous_values": { }
    }
  • Remove a core node from the MRS cluster.
    PUT /v1.1/{project_id}/cluster_infos/{cluster_id}
    
    { 
        "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": { }
    }
  • Remove a Task node from the MRS cluster.
    PUT /v1.1/{project_id}/cluster_infos/{cluster_id}
    
    { 
        "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": { }
    }
  • Remove a specified Task node from the MRS cluster.
    PUT /v1.1/{project_id}/cluster_infos/{cluster_id}
    
    { 
        "service_id": "",  
        "plan_id": "",  
        "parameters": { 
            "order_id": "",  
            "scale_type": "scale_in",  
            "node_id": "node_orderadd",  
            "node_group": "task_node_default_group",
            "instances": "2",
            "server_ids": ["c9573435-7814-4b2c-9131-ad78b814414c", "a4951009-6a0f-4e7b-9c81-9d4bd1f8c537"]  
        },  
        "previous_values": { }
    }

Example Response

Status code: 200

The core or task node has been added or removed.

{
    "result": "succeeded"
}

Status Codes

  • Table 6 describes the status code.
    Table 6 Status code

    Status Code

    Description

    200

    The core or task nodes have been added or removed.

Error Codes

See Error Codes.