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

Adding Components to a Cluster

Function

This API is used to add components to a cluster.

URI

POST /v2/{project_id}/clusters/{cluster_id}/components

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. 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 body parameters

Parameter

Mandatory

Type

Description

components_install_mode

Yes

Array of ComponentInstallMode objects

Explanation

Component installation details. For details about the parameters, see Table 3.

Constraints

N/A

Table 3 ComponentInstallMode

Parameter

Mandatory

Type

Description

component

Yes

String

Explanation

Component name

Constraints

N/A

Value range

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

Default value

N/A

node_groups

Yes

Array of AssignedNodeGroup objects

Explanation

Role deployment information of the component. For details, see Table 4.

Constraints

N/A

component_user_password

No

String

Explanation

User password of the component. The password is used for machine-machine account to connect to the ClickHouse component. The password:

Constraints

N/A

Value range

  • Must contain 8 to 26 characters.
  • Cannot be the username or the username spelled backwards.
  • Must contain every type of the following:
  • Lowercase letters
  • Uppercase letters
  • Numbers
  • Special characters (!@$%^-_=+[{}]:,./?)

Default value

N/A

component_default_password

No

String

Explanation

Default user password of the component. The password is used for human-machine account to connect to the ClickHouse component. The password:

Constraints

N/A

Value range

  • Must contain 8 to 26 characters.
  • Cannot be the username or the username spelled backwards.
  • Must contain every type of the following:
  • Lowercase letters
  • Uppercase letters
  • Numbers
  • Special characters (!@$%^-_=+[{}]:,./?)

Default value

N/A

Table 4 AssignedNodeGroup

Parameter

Mandatory

Type

Description

name

Yes

String

Explanation

Node group name.

Constraints

N/A

Value range

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

Default value

N/A

assigned_roles

Yes

Array of strings

Explanation

Role deployment information. You can specify the roles deployed in a node group. This parameter is a string array. Each string represents a role expression. Role expression definition:

  • If the role is deployed on all nodes in a node group, set this parameter to {role name}, for example, DataNode.
  • If the role is deployed on a specified subscript node in the node group: {role name}:{index1},{index2}…,{indexN}, for example, NameNode:1,2. The subscript starts from 1.
  • For details about the available roles, see Roles and Components Supported by MRS.

Constraints

The number of records cannot exceed 1,000.

Response Parameters

Status code: 200

Table 5 Response body parameter

Parameter

Type

Description

result

String

Explanation

Result of the request for updating a mapping.

Value range

  • succeeded: The operation is successful.
  • failed: The operation failed.

Example Request

  • Add the ClickHouse component to a cluster in normal mode.
    v2/f77c10d14a544393a24e5f0bf53202b6/clusters/ff879d3a-e5d5-4485-a9b6-c673b52673fa/components
    
    {
      "components_install_mode" : [ {
        "component" : "ClickHouse",
        "node_groups" : [ {
          "name" : "master_node_default_group",
          "assigned_roles" : [ "ClickHouseServer:1,2" ]
        }, {
          "name" : "node_group_1",
          "assigned_roles" : [ "ClickHouseServer", "ClickHouseBalancer" ]
        } ],
        "component_user_password" : "*****",
        "component_default_password" : "*****"
      } ]
    }
  • Add the HBase component.
    v2/f77c10d14a544393a24e5f0bf53202b6/clusters/ff879d3a-e5d5-4485-a9b6-c673b52673fa/components
    
    {
      "components_install_mode" : [ {
        "component" : "HBase",
        "node_groups" : [ {
          "name" : "master_node_default_group",
          "assigned_roles" : [ "RegionServer", "HMaster" ]
        } ]
      } ]
    }

Example Response

Status code: 200

Processing result of a request:

{
  "result" : "succeeded"
}

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.