Resizing a Cluster - ModifyClusterNode
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 supports sample SDK code debugging.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, no identity policy-based permissions are required for calling this API.
URI
- Format
- Parameter description
Table 1 URI parameters Parameter
Mandatory
Type
Description
project_id
Yes
String
Definition
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.
Constraints
N/A
Range
The value must consist of 1 to 64 characters. Only letters and digits are allowed.
Default Value
N/A
cluster_id
Yes
String
Definition
Cluster ID For details about how to obtain the cluster ID, see Obtaining a Cluster ID.
Constraints
N/A
Range
The value can contain 1 to 64 characters, including only letters, digits, underscores (_), and hyphens (-).
Default Value
N/A
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| service_id | No | String | Definition Service ID. This parameter is reserved for extension. You do not need to set this parameter. Constraints N/A Range N/A Default Value N/A |
| plan_id | No | String | Definition Plan ID. This parameter is reserved for extension. You do not need to set this parameter. Constraints N/A Range N/A Default Value N/A |
| parameters | Yes | ClusterScalingParams object | Definition Request parameters. For details, see Table 3. Constraints N/A Range N/A Default Value N/A |
| previous_values | No | Map<String,String> | Definition An extended interface. The key is the parameter name, and the value is the parameter value. This parameter is reserved and does not require user configuration. Constraints N/A Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| order_id | No | String | Definition Order ID obtained by the system during scale-out or scale-in. You do not need to set the parameter. Constraints N/A Range N/A Default Value N/A |
| scale_type | Yes | String | Definition Operation type on the cluster node. Constraints N/A Range
Default Value N/A |
| node_id | Yes | String | Definition ID of the newly added or removed node. The parameter value is fixed to node_orderadd. Constraints N/A Range N/A Default Value N/A |
| node_group | No | String | Definition Node group to be scaled out or in Constraints N/A Range
Default Value core_node_default_group |
| task_node_info | No | Object | Definition Task node specifications. For more parameter description, see Table 4. Constraints
Range N/A Default Value N/A |
| instances | Yes | Integer | Definition Number of nodes to be added or removed Constraints
Range ≥1 Default Value N/A |
| skip_bootstrap_scripts | No | String | Definition 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 Range
Default Value false |
| scale_without_start | No | Boolean | Definition Whether to start components on the added nodes after cluster scale-out Constraints N/A Range
Default Value N/A |
| server_ids | No | Array of strings | Definition ID list of Task nodes to be deleted during task node scale-in. Constraints
Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| node_size | Yes | String | Definition 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 Range N/A Default Value N/A |
| data_volume_type | Yes | String | Definition Data disk storage type of the Task node. Supported types include SATA, SAS, and SSD. Constraints N/A Range
Default Value N/A |
| data_volume_count | Yes | Integer | Definition Number of data disks of a Task node. Constraints N/A Range 0-20 Default Value N/A |
| data_volume_size | Yes | Integer | Definition Data disk storage space of a Task node. You only need to pass in a number without the unit GB. Constraints N/A Range 100-32000 Default Value N/A |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| result | String | Definition Operation result Range
|
Example Request
- Scale out the MRS cluster by adding one Core node.
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 there is no Task node, add one 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": { } } - Scale in the MRS cluster by removing one Core node.
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": { } } - Scale in the MRS cluster by removing one Task node.
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"
} SDK Sample Code
The SDK sample code is as follows.
-
Scale out the MRS cluster by adding one Core node.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.mrs.v1.region.MrsRegion; import com.huaweicloud.sdk.mrs.v1.*; import com.huaweicloud.sdk.mrs.v1.model.*; import java.util.Map; import java.util.HashMap; public class UpdateClusterScalingSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); MrsClient client = MrsClient.newBuilder() .withCredential(auth) .withRegion(MrsRegion.valueOf("<YOUR REGION>")) .build(); UpdateClusterScalingRequest request = new UpdateClusterScalingRequest(); request.withClusterId("{cluster_id}"); ClusterScalingReq body = new ClusterScalingReq(); ClusterScalingParams parametersbody = new ClusterScalingParams(); parametersbody.withOrderId("") .withScaleType(ClusterScalingParams.ScaleTypeEnum.fromValue("scale_out")) .withNodeId("node_orderadd") .withNodeGroup("core_node_default_group") .withSkipBootstrapScripts("false") .withScaleWithoutStart(false) .withInstances(1); body.withParameters(parametersbody); body.withPlanId(""); body.withServiceId(""); request.withBody(body); try { UpdateClusterScalingResponse response = client.updateClusterScaling(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } }
-
When the number of Task nodes is greater than zero, scale out the MRS cluster by adding one Task node.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.mrs.v1.region.MrsRegion; import com.huaweicloud.sdk.mrs.v1.*; import com.huaweicloud.sdk.mrs.v1.model.*; import java.util.Map; import java.util.HashMap; public class UpdateClusterScalingSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); MrsClient client = MrsClient.newBuilder() .withCredential(auth) .withRegion(MrsRegion.valueOf("<YOUR REGION>")) .build(); UpdateClusterScalingRequest request = new UpdateClusterScalingRequest(); request.withClusterId("{cluster_id}"); ClusterScalingReq body = new ClusterScalingReq(); ClusterScalingParams parametersbody = new ClusterScalingParams(); parametersbody.withOrderId("") .withScaleType(ClusterScalingParams.ScaleTypeEnum.fromValue("scale_out")) .withNodeId("node_orderadd") .withNodeGroup("task_node_default_group") .withSkipBootstrapScripts("false") .withScaleWithoutStart(false) .withInstances(1); body.withParameters(parametersbody); body.withPlanId(""); body.withServiceId(""); request.withBody(body); try { UpdateClusterScalingResponse response = client.updateClusterScaling(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } }
-
When the number of Task nodes is equal to zero, scale out the MRS cluster by adding one Task node with the specification s3.xlarge.2.linux.bigdata.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.mrs.v1.region.MrsRegion; import com.huaweicloud.sdk.mrs.v1.*; import com.huaweicloud.sdk.mrs.v1.model.*; import java.util.Map; import java.util.HashMap; public class UpdateClusterScalingSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); MrsClient client = MrsClient.newBuilder() .withCredential(auth) .withRegion(MrsRegion.valueOf("<YOUR REGION>")) .build(); UpdateClusterScalingRequest request = new UpdateClusterScalingRequest(); request.withClusterId("{cluster_id}"); ClusterScalingReq body = new ClusterScalingReq(); TaskNodeInfo taskNodeInfoParameters = new TaskNodeInfo(); taskNodeInfoParameters.withNodeSize("s3.xlarge.2.linux.bigdata") .withDataVolumeType(TaskNodeInfo.DataVolumeTypeEnum.fromValue("SATA")) .withDataVolumeCount(2) .withDataVolumeSize(600); ClusterScalingParams parametersbody = new ClusterScalingParams(); parametersbody.withOrderId("") .withScaleType(ClusterScalingParams.ScaleTypeEnum.fromValue("scale_out")) .withNodeId("node_orderadd") .withNodeGroup("task_node_default_group") .withScaleWithoutStart(false) .withInstances(1) .withTaskNodeInfo(taskNodeInfoParameters); body.withParameters(parametersbody); body.withPlanId(""); body.withServiceId(""); request.withBody(body); try { UpdateClusterScalingResponse response = client.updateClusterScaling(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } }
-
Scale in the MRS cluster by removing one Core node.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.mrs.v1.region.MrsRegion; import com.huaweicloud.sdk.mrs.v1.*; import com.huaweicloud.sdk.mrs.v1.model.*; import java.util.Map; import java.util.HashMap; public class UpdateClusterScalingSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); MrsClient client = MrsClient.newBuilder() .withCredential(auth) .withRegion(MrsRegion.valueOf("<YOUR REGION>")) .build(); UpdateClusterScalingRequest request = new UpdateClusterScalingRequest(); request.withClusterId("{cluster_id}"); ClusterScalingReq body = new ClusterScalingReq(); ClusterScalingParams parametersbody = new ClusterScalingParams(); parametersbody.withOrderId("") .withScaleType(ClusterScalingParams.ScaleTypeEnum.fromValue("scale_in")) .withNodeId("node_orderadd") .withNodeGroup("core_node_default_group") .withInstances(1); body.withParameters(parametersbody); body.withPlanId(""); body.withServiceId(""); request.withBody(body); try { UpdateClusterScalingResponse response = client.updateClusterScaling(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } }
-
Scale in the MRS cluster by removing one Task node.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.mrs.v1.region.MrsRegion; import com.huaweicloud.sdk.mrs.v1.*; import com.huaweicloud.sdk.mrs.v1.model.*; import java.util.Map; import java.util.HashMap; public class UpdateClusterScalingSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); MrsClient client = MrsClient.newBuilder() .withCredential(auth) .withRegion(MrsRegion.valueOf("<YOUR REGION>")) .build(); UpdateClusterScalingRequest request = new UpdateClusterScalingRequest(); request.withClusterId("{cluster_id}"); ClusterScalingReq body = new ClusterScalingReq(); ClusterScalingParams parametersbody = new ClusterScalingParams(); parametersbody.withOrderId("") .withScaleType(ClusterScalingParams.ScaleTypeEnum.fromValue("scale_in")) .withNodeId("node_orderadd") .withNodeGroup("task_node_default_group") .withInstances(1); body.withParameters(parametersbody); body.withPlanId(""); body.withServiceId(""); request.withBody(body); try { UpdateClusterScalingResponse response = client.updateClusterScaling(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } }
-
Scale in the MRS cluster by removing specified Task nodes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.mrs.v1.region.MrsRegion; import com.huaweicloud.sdk.mrs.v1.*; import com.huaweicloud.sdk.mrs.v1.model.*; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; public class UpdateClusterScalingSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); MrsClient client = MrsClient.newBuilder() .withCredential(auth) .withRegion(MrsRegion.valueOf("<YOUR REGION>")) .build(); UpdateClusterScalingRequest request = new UpdateClusterScalingRequest(); request.withClusterId("{cluster_id}"); ClusterScalingReq body = new ClusterScalingReq(); List<String> listParametersServerIds = new ArrayList<>(); listParametersServerIds.add("c9573435-7814-4b2c-9131-ad78b814414c"); listParametersServerIds.add("a4951009-6a0f-4e7b-9c81-9d4bd1f8c537"); ClusterScalingParams parametersbody = new ClusterScalingParams(); parametersbody.withOrderId("") .withScaleType(ClusterScalingParams.ScaleTypeEnum.fromValue("scale_in")) .withNodeId("node_orderadd") .withNodeGroup("task_node_default_group") .withServerIds(listParametersServerIds) .withInstances(2); body.withParameters(parametersbody); body.withPlanId(""); body.withServiceId(""); request.withBody(body); try { UpdateClusterScalingResponse response = client.updateClusterScaling(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } }
-
Scale out the MRS cluster by adding one Core node.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkmrs.v1.region.mrs_region import MrsRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkmrs.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = MrsClient.new_builder() \ .with_credentials(credentials) \ .with_region(MrsRegion.value_of("<YOUR REGION>")) \ .build() try: request = UpdateClusterScalingRequest() request.cluster_id = "{cluster_id}" parametersbody = ClusterScalingParams( order_id="", scale_type="scale_out", node_id="node_orderadd", node_group="core_node_default_group", skip_bootstrap_scripts="false", scale_without_start=False, instances=1 ) request.body = ClusterScalingReq( parameters=parametersbody, plan_id="", service_id="" ) response = client.update_cluster_scaling(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
-
When the number of Task nodes is greater than zero, scale out the MRS cluster by adding one Task node.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkmrs.v1.region.mrs_region import MrsRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkmrs.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = MrsClient.new_builder() \ .with_credentials(credentials) \ .with_region(MrsRegion.value_of("<YOUR REGION>")) \ .build() try: request = UpdateClusterScalingRequest() request.cluster_id = "{cluster_id}" parametersbody = ClusterScalingParams( order_id="", scale_type="scale_out", node_id="node_orderadd", node_group="task_node_default_group", skip_bootstrap_scripts="false", scale_without_start=False, instances=1 ) request.body = ClusterScalingReq( parameters=parametersbody, plan_id="", service_id="" ) response = client.update_cluster_scaling(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
-
When the number of Task nodes is equal to zero, scale out the MRS cluster by adding one Task node with the specification s3.xlarge.2.linux.bigdata.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkmrs.v1.region.mrs_region import MrsRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkmrs.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = MrsClient.new_builder() \ .with_credentials(credentials) \ .with_region(MrsRegion.value_of("<YOUR REGION>")) \ .build() try: request = UpdateClusterScalingRequest() request.cluster_id = "{cluster_id}" taskNodeInfoParameters = TaskNodeInfo( node_size="s3.xlarge.2.linux.bigdata", data_volume_type="SATA", data_volume_count=2, data_volume_size=600 ) parametersbody = ClusterScalingParams( order_id="", scale_type="scale_out", node_id="node_orderadd", node_group="task_node_default_group", scale_without_start=False, instances=1, task_node_info=taskNodeInfoParameters ) request.body = ClusterScalingReq( parameters=parametersbody, plan_id="", service_id="" ) response = client.update_cluster_scaling(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
-
Scale in the MRS cluster by removing one Core node.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkmrs.v1.region.mrs_region import MrsRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkmrs.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = MrsClient.new_builder() \ .with_credentials(credentials) \ .with_region(MrsRegion.value_of("<YOUR REGION>")) \ .build() try: request = UpdateClusterScalingRequest() request.cluster_id = "{cluster_id}" parametersbody = ClusterScalingParams( order_id="", scale_type="scale_in", node_id="node_orderadd", node_group="core_node_default_group", instances=1 ) request.body = ClusterScalingReq( parameters=parametersbody, plan_id="", service_id="" ) response = client.update_cluster_scaling(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
-
Scale in the MRS cluster by removing one Task node.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkmrs.v1.region.mrs_region import MrsRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkmrs.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = MrsClient.new_builder() \ .with_credentials(credentials) \ .with_region(MrsRegion.value_of("<YOUR REGION>")) \ .build() try: request = UpdateClusterScalingRequest() request.cluster_id = "{cluster_id}" parametersbody = ClusterScalingParams( order_id="", scale_type="scale_in", node_id="node_orderadd", node_group="task_node_default_group", instances=1 ) request.body = ClusterScalingReq( parameters=parametersbody, plan_id="", service_id="" ) response = client.update_cluster_scaling(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
-
Scale in the MRS cluster by removing specified Task nodes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkmrs.v1.region.mrs_region import MrsRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkmrs.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = MrsClient.new_builder() \ .with_credentials(credentials) \ .with_region(MrsRegion.value_of("<YOUR REGION>")) \ .build() try: request = UpdateClusterScalingRequest() request.cluster_id = "{cluster_id}" listServerIdsParameters = [ "c9573435-7814-4b2c-9131-ad78b814414c", "a4951009-6a0f-4e7b-9c81-9d4bd1f8c537" ] parametersbody = ClusterScalingParams( order_id="", scale_type="scale_in", node_id="node_orderadd", node_group="task_node_default_group", server_ids=listServerIdsParameters, instances=2 ) request.body = ClusterScalingReq( parameters=parametersbody, plan_id="", service_id="" ) response = client.update_cluster_scaling(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
-
Scale out the MRS cluster by adding one Core node.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" mrs "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := mrs.NewMrsClient( mrs.MrsClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.UpdateClusterScalingRequest{} request.ClusterId = "{cluster_id}" orderIdParameters:= "" nodeGroupParameters:= "core_node_default_group" skipBootstrapScriptsParameters:= "false" scaleWithoutStartParameters:= false parametersbody := &model.ClusterScalingParams{ OrderId: &orderIdParameters, ScaleType: model.GetClusterScalingParamsScaleTypeEnum().SCALE_OUT, NodeId: "node_orderadd", NodeGroup: &nodeGroupParameters, SkipBootstrapScripts: &skipBootstrapScriptsParameters, ScaleWithoutStart: &scaleWithoutStartParameters, Instances: int32(1), } planIdClusterScalingReq:= "" serviceIdClusterScalingReq:= "" request.Body = &model.ClusterScalingReq{ Parameters: parametersbody, PlanId: &planIdClusterScalingReq, ServiceId: &serviceIdClusterScalingReq, } response, err := client.UpdateClusterScaling(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
-
When the number of Task nodes is greater than zero, scale out the MRS cluster by adding one Task node.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" mrs "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := mrs.NewMrsClient( mrs.MrsClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.UpdateClusterScalingRequest{} request.ClusterId = "{cluster_id}" orderIdParameters:= "" nodeGroupParameters:= "task_node_default_group" skipBootstrapScriptsParameters:= "false" scaleWithoutStartParameters:= false parametersbody := &model.ClusterScalingParams{ OrderId: &orderIdParameters, ScaleType: model.GetClusterScalingParamsScaleTypeEnum().SCALE_OUT, NodeId: "node_orderadd", NodeGroup: &nodeGroupParameters, SkipBootstrapScripts: &skipBootstrapScriptsParameters, ScaleWithoutStart: &scaleWithoutStartParameters, Instances: int32(1), } planIdClusterScalingReq:= "" serviceIdClusterScalingReq:= "" request.Body = &model.ClusterScalingReq{ Parameters: parametersbody, PlanId: &planIdClusterScalingReq, ServiceId: &serviceIdClusterScalingReq, } response, err := client.UpdateClusterScaling(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
-
When the number of Task nodes is equal to zero, scale out the MRS cluster by adding one Task node with the specification s3.xlarge.2.linux.bigdata.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" mrs "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := mrs.NewMrsClient( mrs.MrsClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.UpdateClusterScalingRequest{} request.ClusterId = "{cluster_id}" taskNodeInfoParameters := &model.TaskNodeInfo{ NodeSize: "s3.xlarge.2.linux.bigdata", DataVolumeType: model.GetTaskNodeInfoDataVolumeTypeEnum().SATA, DataVolumeCount: int32(2), DataVolumeSize: int32(600), } orderIdParameters:= "" nodeGroupParameters:= "task_node_default_group" scaleWithoutStartParameters:= false parametersbody := &model.ClusterScalingParams{ OrderId: &orderIdParameters, ScaleType: model.GetClusterScalingParamsScaleTypeEnum().SCALE_OUT, NodeId: "node_orderadd", NodeGroup: &nodeGroupParameters, ScaleWithoutStart: &scaleWithoutStartParameters, Instances: int32(1), TaskNodeInfo: taskNodeInfoParameters, } planIdClusterScalingReq:= "" serviceIdClusterScalingReq:= "" request.Body = &model.ClusterScalingReq{ Parameters: parametersbody, PlanId: &planIdClusterScalingReq, ServiceId: &serviceIdClusterScalingReq, } response, err := client.UpdateClusterScaling(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
-
Scale in the MRS cluster by removing one Core node.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" mrs "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := mrs.NewMrsClient( mrs.MrsClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.UpdateClusterScalingRequest{} request.ClusterId = "{cluster_id}" orderIdParameters:= "" nodeGroupParameters:= "core_node_default_group" parametersbody := &model.ClusterScalingParams{ OrderId: &orderIdParameters, ScaleType: model.GetClusterScalingParamsScaleTypeEnum().SCALE_IN, NodeId: "node_orderadd", NodeGroup: &nodeGroupParameters, Instances: int32(1), } planIdClusterScalingReq:= "" serviceIdClusterScalingReq:= "" request.Body = &model.ClusterScalingReq{ Parameters: parametersbody, PlanId: &planIdClusterScalingReq, ServiceId: &serviceIdClusterScalingReq, } response, err := client.UpdateClusterScaling(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
-
Scale in the MRS cluster by removing one Task node.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" mrs "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := mrs.NewMrsClient( mrs.MrsClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.UpdateClusterScalingRequest{} request.ClusterId = "{cluster_id}" orderIdParameters:= "" nodeGroupParameters:= "task_node_default_group" parametersbody := &model.ClusterScalingParams{ OrderId: &orderIdParameters, ScaleType: model.GetClusterScalingParamsScaleTypeEnum().SCALE_IN, NodeId: "node_orderadd", NodeGroup: &nodeGroupParameters, Instances: int32(1), } planIdClusterScalingReq:= "" serviceIdClusterScalingReq:= "" request.Body = &model.ClusterScalingReq{ Parameters: parametersbody, PlanId: &planIdClusterScalingReq, ServiceId: &serviceIdClusterScalingReq, } response, err := client.UpdateClusterScaling(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
-
Scale in the MRS cluster by removing specified Task nodes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" mrs "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := mrs.NewMrsClient( mrs.MrsClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.UpdateClusterScalingRequest{} request.ClusterId = "{cluster_id}" var listServerIdsParameters = []string{ "c9573435-7814-4b2c-9131-ad78b814414c", "a4951009-6a0f-4e7b-9c81-9d4bd1f8c537", } orderIdParameters:= "" nodeGroupParameters:= "task_node_default_group" parametersbody := &model.ClusterScalingParams{ OrderId: &orderIdParameters, ScaleType: model.GetClusterScalingParamsScaleTypeEnum().SCALE_IN, NodeId: "node_orderadd", NodeGroup: &nodeGroupParameters, ServerIds: &listServerIdsParameters, Instances: int32(2), } planIdClusterScalingReq:= "" serviceIdClusterScalingReq:= "" request.Body = &model.ClusterScalingReq{ Parameters: parametersbody, PlanId: &planIdClusterScalingReq, ServiceId: &serviceIdClusterScalingReq, } response, err := client.UpdateClusterScaling(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
| Status Code | Description |
|---|---|
| 200 | Core or Task nodes added or removed successfully. |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot