Creating a Cluster¶
Function¶
This API is used to create a cluster.
URI¶
POST /v1.0/{project_id}/clusters
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID. For details about how to obtain a project ID, see Obtaining a Project ID and Name. |
Request¶
Table 2 describes the request parameters.
Parameter | Mandatory | Type | Description |
---|---|---|---|
cluster | Yes | Object | Cluster. For details about related parameters, see Table 3. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
instance | Yes | Object | Instance. For details about related parameters, see Table 4. |
datastore | Yes | Object | Type of the data search engine. For details about related parameters, see Table 7. |
name | Yes | String | Cluster name. It contains 4 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. The value must start with a letter. |
instanceNum | Yes | Integer | Number of clusters. The value range is 1 to 32. |
backupStrategy | No | Object | Automatic snapshot creation. This function is disabled by default. For details about related parameters, see Table 8. Note The automatic snapshot creation policy is enabled only if this parameter is specified. |
diskEncryption | Yes | Object | Indicates whether disks are encrypted. For details about related parameters, see Table 9. |
httpsEnable | No | String | Indicates whether communication is encrypted on the cluster. Available values include true and false. By default, communication encryption is disabled. When httpsEnable is set to true, authorityEnable must be set to true.
|
authorityEnable | No | Boolean | Indicates whether to enable authentication. Available values include true and false. Authentication is disabled by default. When authentication is enabled, httpsEnable must be set to true.
|
adminPwd | No | String | Password of the cluster user admin in security mode. This parameter is mandatory only when authorityEnable is set to true. Note
|
enterprise_project_id | No | String | Enterprise project ID. When creating a cluster, associate the enterprise project ID with the cluster. The value can contain a maximum of 36 characters. It is string 0 or in UUID format with hyphens (-). Value 0 indicates the default enterprise project. Note For details about how to obtain enterprise project IDs and features, see the . |
tags | No | Array of tag objects | Tags in a cluster. Note For details about the tag feature, see the Tag Management Service. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
flavorRef | Yes | String | Instance flavor name. For example:
|
volume | Yes | Object | Information about the volume. For details about related parameters, see Table 5. |
nics | Yes | Object | Subnet information. For details about related parameters, see Table 6. |
availability_zone | No | String | Availability zone (AZ). A single AZ is created when this parameter is not specified. Separate multiple AZs with commas (,), for example, az1,az2. AZs must be unique and ensure that the number of nodes be at least the number of AZs. If the number of nodes is a multiple of the number of AZs, the nodes are evenly distributed to each AZ. If the number of nodes is not a multiple of the number of AZs, the absolute difference between node quantity in any two AZs is 1 at most. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
volume_type | Yes | String | COMMON: Common I/O HIGH: High I/O ULTRAHIGH: Ultra-high I/O |
size | Yes | Integer | Volume size. The minimum value is 40. The value must be a multiple of 4 and 10. Unit: GB |
Parameter | Mandatory | Type | Description |
---|---|---|---|
vpcId | Yes | String | VPC ID, which is used for configuring cluster network. |
netId | Yes | String | Subnet ID. All instances in a cluster must have the same subnets and security groups. |
securityGroupId | Yes | String | Security group ID. All instances in a cluster must have the same subnets and security groups. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
version | Yes | String | Engine version. For details about the supported versions, see Supported Cluster Versions. |
type | Yes | String | Engine type. Elasticsearch and OpenSearch are supported. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
period | Yes | String | Time when a snapshot is created every day. Snapshots can only be created on the hour. The time format is the time followed by the time zone, specifically, HH:mm z. In the format, HH:mm refers to the hour time and z refers to the time zone, for example, 00:00 GMT+08:00 and 01:00 GMT+02:00. |
prefix | Yes | String | Prefix of the name of the snapshot that is automatically created. |
keepday | Yes | Integer | Number of days for which automatically created snapshots are reserved. Value range: 1 to 90 |
bucket | No | String | OBS bucket used for storing backup. If there is snapshot data in an OBS bucket, only the OBS bucket will be used for backup storage and cannot be changed. |
basePath | No | String | Storage path of the snapshot in the OBS bucket. |
agency | No | String | IAM agency used to access OBS. Note If none of the bucket, basePath, and agency parameters are specified, the system will automatically create an OBS bucket and an IAM agency. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
systemEncrypted | Yes | String | Value 1 indicates encryption is performed, and value 0 indicates encryption is not performed. |
systemCmkid | Yes | String | Key ID.
|
Parameter | Mandatory | Type | Description |
---|---|---|---|
key | Yes | String | Tag key. The value can contain 1 to 36 characters. Only digits, letters, hyphens (-) and underscores (_) are allowed. |
value | Yes | String | Tag value. The value can contain 0 to 43 characters. Only digits, letters, hyphens (-) and underscores (_) are allowed. |
Response¶
Table 11 describes the response parameters.
Parameter | Type | Description |
---|---|---|
id | String | Cluster ID. |
name | String | Cluster name |
Examples¶
Example request
POST /v1.0/6204a5bd270343b5885144cf9c8c158d/clusters
{
"cluster": {
"name": "ES-Test",
"instanceNum": 4,
"instance": {
"availability_zone": "eu-du-01",
"flavorRef": "css.large.8",
"volume": {
"volume_type": "COMMON",
"size": 100
},
"nics": {
"vpcId": "fccd753c-91c3-40e2-852f-5ddf76d1a1b2",
"netId": "af1c65ae-c494-4e24-acd8-81d6b355c9f1",
"securityGroupId": "7e3fed21-1a44-4101-ab29-34e57124f614"
}
},
"httpsEnable": "false",
"diskEncryption": {
"systemEncrypted": "1",
"systemCmkid": "42546bb1-8025-4ad1-868f-600729c341ae"
}
}
}
Example response
{
"cluster": {
"id": "ef683016-871e-48bc-bf93-74a29d60d214",
"name": "ES-Test"
}
}
Status Code¶
Table 13 describes the status code.
Status Code | Code | Status Code Description |
---|---|---|
400 | BadRequest | Invalid request. Modify the request instead of retrying. |
409 | Conflict | The request cannot be processed due to a conflict. This status code indicates that the resource that the client attempts to create already exits, or the request fails to be processed because of the update of the conflict request. |
412 | Precondition Failed | The server does not meet one of the preconditions that the requester puts on the request. |
200 | OK | The request is processed successfully. |