Performing a Scale-Out Check
Function
This API is used to conduct a precheck for cluster scale-out to identify failures caused by insufficient subnets or permissions.
Calling Method
For details, see Calling APIs.
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, the following identity policy-based permissions are required.
URI
POST /v2/{project_id}/clusters/{cluster_id}/grow-check
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| cluster_id | Yes | String | Definition Cluster ID. For details about how to obtain the value, see Obtaining the Cluster ID. Constraints N/A Range N/A Default Value N/A |
| project_id | Yes | String | Definition Project ID. To obtain the value, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| scale_out | Yes | ScaleOut object | Definition Request body for adding an idle node or scaling out a cluster. Constraints N/A Range N/A Default Value N/A |
| logical_cluster_name | No | String | Definition: Name of the logical cluster, which is required when the cluster is scaled out to a logical cluster. Constraints: None Range: None Default Value: None |
| create_node_only | No | Boolean | Definition Whether only idle nodes are added. Constraints N/A Range true: Only nodes are added. If scale-out is required, perform it separately. false: Nodes are added and the cluster is scaled out. Default Value false |
| waiting_for_killing | No | Integer | Definition Time before blocked job termination. Constraints This parameter is available only for GuestAgent 8.2.1 or later. Range 30 to 1200 Default Value 0 (not limited) |
| auto_redistribute | No | Boolean | Definition: Whether to automatically start redistribution after scale-out. The default value is Yes. If this parameter is set to false, redistribution is not performed after scale-out. In this case, the cluster task information is in the to-be-redistributed state and other operations cannot be performed. Constraints: None Range:
Default Value: true |
| mode | No | String | Definition Scale-out mode, which can be online or offline. During online scale-out, data can be added, deleted, modified, and queried, and some DDL syntaxes are supported. Errors will be reported for unsupported syntaxes. Online scale-out has less impact on services. In offline mode, services are interrupted for a short period of time and the database is unavailable. Constraints N/A Range Default Value read-only |
| redis_conf | No | RedisConfReq object | Definition Redistribution configuration. The offline mode is used by default. Constraints N/A Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| count | Yes | Integer | Definition Number of nodes to be added. Range Greater than or equal to 3 |
| subnet_id | No | String | Definition Subnet ID. Range The value is a valid subnet ID in the same VPC. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| redis_mode | Yes | String | Definition Redistribution mode. The impact on services varies depending on the mode. You are advised to contact O&M personnel for evaluation before changing the mode. Constraints The value must be a valid DWS cluster ID. Range offline online Default Value offline |
| parallel_jobs | Yes | Integer | Definition Number of concurrent jobs. The default value is 4. Constraints N/A Range 1 to 200 Default Value 4 |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| data | Array of GrowCheckResult objects | Definition Pre-scale-out check information. Range N/A |
| note | NoteInfo object | Definition Message displayed before the scale-out. Value range N/A |
| Parameter | Type | Description |
|---|---|---|
| pass | Boolean | Definition Whether the check is passed. By default, the items that pass the check are not displayed. Range true/false |
| reason | String | Definition Reason that the check fails. Range N/A |
| required | Boolean | Definition Whether the check item is mandatory. Range |
| desc | String | Definition Description. Range N/A |
| type | String | Definition Type. Range Quota, permission, version, and status |
| Parameter | Type | Description |
|---|---|---|
| bucket_split_info | BucketSplitInfo object | Definition: Bucket splitting information, which is returned only when the cluster is scaled out to an existing logical cluster. Range: None |
| Parameter | Type | Description |
|---|---|---|
| current_dn_num | Integer | Definition Number of current DNs. Range N/A |
| after_scale_out_dn_num | Integer | Definition Number of DN nodes after scale-out. Range N/A |
| current_bucket_num | Integer | Definition Number of current buckets. Range N/A |
| after_scale_out_bucket_num | Integer | Definition Number of buckets after scale-out. Range N/A |
| is_bucket_split | Boolean | Definition Whether bucket splitting is involved in scale-out. Range N/A |
| bucket_tilt_rate | String | Definition Bucket tilt rate on DN nodes. It is used to measure the imbalance of buckets on DN nodes. Range N/A |
| after_scale_out_bucket_tilt_rate | String | Definition Bucket tilt rate on DN nodes after scale-out. It is used to measure the imbalance of buckets on DN nodes after scale-out. Range N/A |
Example Requests
Check whether the quota or permission is sufficient when three nodes are added to a cluster.
POST https://{Endpoint}/v2/89cd04f168b84af6be287f71730fdb4b/clusters/4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba90/grow-check
{
"scale_out" : {
"count" : 3
}
} Example Responses
Status code: 200
Request submitted.
{
"note" : {
"bucket_split_info" : {
"current_dn_num" : 6,
"after_scale_out_bucket_num" : 32,
"is_bucket_split" : false,
"after_scale_out_dn_num" : 9,
"bucket_tilt_rate" : "16.67%",
"after_scale_out_bucket_tilt_rate" : "25.00%"
}
},
"data" : [ {
"pass" : false,
"reason" : "Subnet IP address quota exceeded. Required: 3; Used: 249/251",
"required" : true,
"desc" : "Subnet IP address check",
"type" : "Quota"
} ]
} SDK Sample Code
The SDK sample code is as follows.
Check whether the quota or permission is sufficient when three nodes are added to a cluster.
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 | 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.dws.v2.region.DwsRegion; import com.huaweicloud.sdk.dws.v2.*; import com.huaweicloud.sdk.dws.v2.model.*; public class CheckGrowClusterSolution { 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); DwsClient client = DwsClient.newBuilder() .withCredential(auth) .withRegion(DwsRegion.valueOf("<YOUR REGION>")) .build(); CheckGrowClusterRequest request = new CheckGrowClusterRequest(); request.withClusterId("{cluster_id}"); ResizeClusterRequestBody body = new ResizeClusterRequestBody(); ScaleOut scaleOutbody = new ScaleOut(); scaleOutbody.withCount(3); body.withScaleOut(scaleOutbody); request.withBody(body); try { CheckGrowClusterResponse response = client.checkGrowCluster(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()); } } } |
Check whether the quota or permission is sufficient when three nodes are added to a cluster.
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 | # coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkdws.v2.region.dws_region import DwsRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkdws.v2 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 = DwsClient.new_builder() \ .with_credentials(credentials) \ .with_region(DwsRegion.value_of("<YOUR REGION>")) \ .build() try: request = CheckGrowClusterRequest() request.cluster_id = "{cluster_id}" scaleOutbody = ScaleOut( count=3 ) request.body = ResizeClusterRequestBody( scale_out=scaleOutbody ) response = client.check_grow_cluster(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Check whether the quota or permission is sufficient when three nodes are added to a cluster.
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 | package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" dws "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dws/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dws/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dws/v2/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, err := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). SafeBuild() if err != nil { fmt.Println(err) return } hcClient, err := dws.DwsClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). SafeBuild() if err != nil { fmt.Println(err) return } client := dws.NewDwsClient(hcClient) request := &model.CheckGrowClusterRequest{} request.ClusterId = "{cluster_id}" scaleOutbody := &model.ScaleOut{ Count: int32(3), } request.Body = &model.ResizeClusterRequestBody{ ScaleOut: scaleOutbody, } response, err := client.CheckGrowCluster(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 | Request submitted. |
| 400 | Request error. |
| 401 | Authentication failed. |
| 403 | You do not have required permissions. |
| 404 | No resources found. |
| 500 | Internal server error. |
| 503 | Service unavailable. |
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