Help Center/ Cloud Search Service/ API Reference/ API V1/ Cluster Management/ Adding Independent Masters and Clients
Updated on 2025-08-15 GMT+08:00

Adding Independent Masters and Clients

Function

This API is used to add dedicated master and client nodes to an existing cluster that previously does not have such nodes.

Calling Method

For details, see Calling APIs.

URI

POST /v1.0/{project_id}/clusters/{cluster_id}/type/{type}/independent

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition:

Project ID. For details about how to obtain the project ID and name, see Obtaining the Project ID and Name.

Constraints:

N/A

Value range:

Project ID of the account.

Default value:

N/A

cluster_id

Yes

String

Definition:

ID of the cluster that needs an independent master or client. For details about how to obtain the cluster ID, see Obtaining the Cluster ID.

Constraints:

N/A

Value range:

Cluster ID.

Default value:

N/A

type

Yes

String

Parameter description:

Types of dedicated nodes to add.

Constraints:

N/A

Options:

  • ess-master: master node

  • ess-client: client node

Default value:

N/A

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

type

Yes

IndependentTypeReq object

Definition:

Master/Client request body parameter.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

is_auto_pay

No

Integer

Definition:

Whether to enable automatic payment from your Huawei Cloud account.

Constraints:

This parameter takes effect only for yearly/monthly clusters.

Value range:

  • 1: Yes. (Discounts and coupons are automatically selected. The fee will be automatically deducted from your Huawei Cloud account.) If the automatic payment fails, an unpaid order will be generated, and you need to manually complete the payment. (During manual payment, you can still modify the discounts and coupons that were automatically selected.)

  • 0: No. (The customer needs to manually pay for the bill. Discounts and coupons can be used.)

Default value:

0

Table 3 IndependentTypeReq

Parameter

Mandatory

Type

Description

flavor_ref

Yes

String

Definition:

Flavor ID.

Constraints:

N/A

Value range:

You can obtain the value of this parameter by calling the API for Obtaining the Instance Specifications List. Select the flavor ID suitable for your cluster version.

Default value:

N/A

node_size

Yes

Integer

Definition:

Number of nodes.

Constraints:

N/A

Value range:

  • If the node type is ess-master, the number of nodes must be an odd number in the range 3 to 10.

  • If the node type is ess-client, the number of nodes must be in the range 1 to 32.

Default value:

N/A

volume_type

Yes

String

Parameter description:

Node storage type.

Constraints:

N/A

Options:

  • COMMON: common I/O

  • HIGH: high I/O

  • ULTRAHIGH: ultra-high I/O

  • ESSD: ultra-fast SSD

Default value:

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

id

String

Definition:

Cluster ID.

Value range:

N/A

Example Requests

Add independent master and client nodes.

POST https://{Endpoint}/v1.0/{project_id}/clusters/ea244205-d641-45d9-9dcb-ab2236bcd07e/type/ess-client/independent

{
  "type" : {
    "flavor_ref" : "d9dc06ae-b9c4-4ef4-acd8-953ef4205e27",
    "node_size" : 3,
    "volume_type" : "COMMON"
  }
}

Example Responses

Status code: 200

Request succeeded.

{
  "id" : "320afa24-ff2a-4f44-8460-6ba95e512ad4"
}

SDK Sample Code

The SDK sample code is as follows.

Java

Add independent master and client 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
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.css.v1.region.CssRegion;
import com.huaweicloud.sdk.css.v1.*;
import com.huaweicloud.sdk.css.v1.model.*;


public class AddIndependentNodeSolution {

    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);

        CssClient client = CssClient.newBuilder()
                .withCredential(auth)
                .withRegion(CssRegion.valueOf("<YOUR REGION>"))
                .build();
        AddIndependentNodeRequest request = new AddIndependentNodeRequest();
        request.withClusterId("{cluster_id}");
        request.withType("{type}");
        IndependentReq body = new IndependentReq();
        IndependentBodyReq typebody = new IndependentBodyReq();
        typebody.withFlavorRef("d9dc06ae-b9c4-4ef4-acd8-953ef4205e27")
            .withNodeSize(3)
            .withVolumeType("COMMON");
        body.withType(typebody);
        request.withBody(body);
        try {
            AddIndependentNodeResponse response = client.addIndependentNode(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());
        }
    }
}

Python

Add independent master and client 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
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkcss.v1.region.css_region import CssRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcss.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 = CssClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(CssRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = AddIndependentNodeRequest()
        request.cluster_id = "{cluster_id}"
        request.type = "{type}"
        typebody = IndependentBodyReq(
            flavor_ref="d9dc06ae-b9c4-4ef4-acd8-953ef4205e27",
            node_size=3,
            volume_type="COMMON"
        )
        request.body = IndependentReq(
            type=typebody
        )
        response = client.add_independent_node(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

Go

Add independent master and client 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
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    css "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/css/v1"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/css/v1/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/css/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 := css.NewCssClient(
        css.CssClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.AddIndependentNodeRequest{}
	request.ClusterId = "{cluster_id}"
	request.Type = "{type}"
	typebody := &model.IndependentBodyReq{
		FlavorRef: "d9dc06ae-b9c4-4ef4-acd8-953ef4205e27",
		NodeSize: int32(3),
		VolumeType: "COMMON",
	}
	request.Body = &model.IndependentReq{
		Type: typebody,
	}
	response, err := client.AddIndependentNode(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

More

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 succeeded.

403

Request rejected.

The server has received the request and understood it, but refused to respond to it. The client should not repeat the request without modifications.

500

The server has received the request but could not understand it.

Error Codes

See Error Codes.