Updated on 2023-11-17 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

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

cluster_id

Yes

String

Cluster ID. For details about how to obtain the cluster ID, see Obtaining a Cluster ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

components_install_mode

Yes

Array of ComponentInstallMode objects

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

Table 3 ComponentInstallMode

Parameter

Mandatory

Type

Description

component

Yes

String

Component name

node_groups

Yes

Array of AssignedNodeGroup objects

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

component_user_password

No

String

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

  • 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 (!@$%^-_=+[{}]:,./?)

component_default_password

No

String

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

  • 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 (!@$%^-_=+[{}]:,./?)
Table 4 AssignedNodeGroup

Parameter

Mandatory

Type

Description

name

Yes

String

Node group name

assigned_roles

Yes

Array of strings

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 some roles, multiple instances of the same role can be deployed on the same node with {role name}[{instance count}], for example, EsNode[9]. You do not need to specify the role location. By default, multiple instances are deployed on all nodes in a node group. For details about the available roles, see the Roles and Components Supported by MRS.

Response Parameters

Status code: 200

Table 5 Response body parameter

Parameter

Type

Description

result

String

Operation result. Value succeeded indicates that the operation is successful, and value failed indicates that the operation fails.

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.