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, see Obtaining the Project ID and Account ID. |
Request
Table 2 describes the request parameters.
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
cluster |
Yes |
Object |
Cluster object. For details about related parameters, see Table 3. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
instance |
Yes |
Object |
Instance object. For details about related parameters, see Table 4. |
|
datastore |
No |
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 cluster instances. The value range is 1 to 32. |
|
backupStrategy |
No |
Object |
Whether automatic snapshot creation is enabled. Enabled by default. For details about related parameters, see Table 8. Enabled by default. |
|
httpsEnable |
No |
Boolean |
Whether communication encryption is performed 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 |
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 administrator admin in security mode. This parameter is mandatory only when authorityEnable is set to true.
NOTE:
The administrator password must meet the following requirements:
|
|
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 Enterprise Management Service User Guide. |
|
tags |
No |
Array of tag objects |
Tags in a cluster.
NOTE:
For details about the tag feature, see the Tag Management Service Overview. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
flavorRef |
Yes |
String |
Instance flavor name. For example:
|
|
volume |
No |
Object |
If flavorRef is set to a local disk flavor, you do not need to set this parameter. You can obtain the local disk flavor by calling the API for obtaining the instance flavor list. Currently, the following local disk flavors are supported:
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). |
|
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, which 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. The value can be 5.5.1, 6.2.3, 6.5.4, or 7.1.1. The default value is 5.5.1. |
|
type |
No |
String |
Engine type. The default value is elasticsearch. Currently, the value can only be elasticsearch. |
|
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+08: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 |
|
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 10 describes the response parameters.
|
Parameter |
Type |
Description |
|---|---|---|
|
cluster |
Object |
Cluster object. For details, see Table 11. |
Examples
Example request
{
"cluster": {
"instance": {
"flavorRef": "ess.spec-ds.xlarge.8",
"nics": {
"vpcId": "087a6df3-5459-417d-86b0-cd36830c09ca",
"netId": "1d5cb532-b506-41c4-b39f-abeb126ba2c1",
"securityGroupId": "1c021648-ed98-45c2-9a55-70839fc7d779"
},
"availability_zone": "cn-north-7b"
},
"name": "Es-test",
"datastore": {
"version": "6.5.4",
"type": "elasticsearch"
},
"instanceNum": 1,
"httpsEnable": true,
"authorityEnable": true,
"adminPwd": "12334fdsf@"
}
}
{
"cluster": {
"id": "ef683016-871e-48bc-bf93-74a29d60d214",
"name": "ES-Test"
}
}
Status Code
Table 12 describes the status code.
|
Status Code |
Code |
Status Code Description |
|---|---|---|
|
400 |
BadRequest |
Invalid request. The client should not repeat the request without modifications. |
|
409 |
Conflict |
The request could not 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. |
Last Article: APIs Related to Cluster Management
Next Article: Querying the List of Clusters
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.