Creating a Cluster (V2)
Function
This API is used to create a cluster that uses multiple different types of nodes. The cluster engine type can be Elasticsearch, OpenSearch, or Logstash.
-
Data node (ess): mandatory. Data nodes store the data of a cluster. If there are no client nodes in the cluster, data nodes will need to additionally handle cluster access and data analytics requests; if there are no master nodes, data nodes will need to provide cluster management.
-
Master nodes (ess-master): optional. Master nodes manage cluster-wide operations, including metadata, indexes, and shard allocation. For large-scale deployments, using dedicated master nodes enhances cluster stability, service availability, and centralized control.
-
Client nodes (ess-client): Client nodes route and coordinate search and index requests, offloading processing from data nodes for enhanced query performance and cluster scalability when there are heavy loads.
-
Cold data nodes (ess-cold): Cold data nodes are used to store and query large quantities of latency-insensitive data. They offer an effective way to manage large datasets while cutting storage costs.
-
OpenSearch clusters support the same nodes as Elasticsearch clusters.
-
Logstash clusters support the creation of Logstash nodes (lgs). Logstash nodes ingest, parse, process, and transmit data.
Constraints
Calling Method
For details, see Calling APIs.
URI
POST /v2.0/{project_id}/clusters
|
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 |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
cluster |
Yes |
CreateClusterBody object |
Definition: Cluster object. Constraints: N/A Value range: N/A Default value: N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
Yes |
String |
Definition: Cluster name. Constraints: N/A Value range: The value must consist of 4 to 32 characters, and must start with a letter. It can only contain digits, letters, periods (.), hyphens (-), and underscores (_). Default value: N/A |
|
desc |
No |
String |
Definition: Cluster description. Constraints: Enter a maximum of 128 characters. Value range: Digits, letters, periods (.), hyphens (-), underscores (_), and other special characters are allowed. Default value: N/A |
|
backupStrategy |
No |
Definition: Automatic snapshot creation. Constraints: The automatic snapshot creation policy is enabled only when backupStrategy is not left blank. Value range: N/A Default value: N/A |
|
|
roles |
Yes |
Array of CreateClusterRolesBody objects |
Definition: Cluster node information. Constraints: N/A Value range: N/A Default value: N/A |
|
nics |
Yes |
Definition: Network configuration information. Constraints: N/A Value range: N/A Default value: N/A |
|
|
enterprise_project_id |
No |
String |
Definition: Enterprise project ID. When you create a cluster, associate the enterprise project ID with the cluster. Constraints: N/A Value range: The value can contain a maximum of 36 characters. It is string 0 or in UUID format with hyphens (-). Default value: 0 indicates an enterprise project. |
|
tags |
No |
Array of CreateClusterTagsBody objects |
Definition: Cluster tags. Constraints: N/A Value range: N/A Default value: N/A |
|
availability_zone |
Yes |
String |
Definition: AZ of the node. The AZ name needs to be specified. Constraints: If multiple AZs are selected, the name of each AZ must be unique, and the number of nodes must be greater than or equal to the number of AZs. If the number of nodes is evenly divisible by the number of AZs, the nodes will be evenly distributed among all AZs. If the number of nodes is not evenly divisible by the number of AZs, the absolute difference between node quantity in any two AZs is 1 at most. To learn more about AZs, see Basic Concepts in CSS Before You Start. Value range: When specifying the AZs of nodes, use commas (,) to separate different AZ names. For example, if multiple AZs are selected for general AZs, the value of availability_zone is region-1a,region-1b,region-1c. Default value: N/A |
|
datastore |
Yes |
CreateClusterDatastoreBody object |
Definition: Engine type of the cluster to be created. Constraints: N/A Value range: The value can be elasticsearch, opensearch, or logstash. Default value: N/A |
|
authorityEnable |
No |
Boolean |
Definition: Whether to enable security authentication for a cluster. Constraints: This parameter is available only for Elasticsearch and OpenSearch clusters. Value range: Default value: false |
|
httpsEnable |
No |
Boolean |
Definition: Whether communication is encrypted on the cluster. Constraints: When httpsEnable is set to true, authorityEnable must be set to true. Only Elasticsearch 6.5.4 security-mode clusters and later support this parameter. HTTPS access can be disabled only for OpenSearch 1.3.6 and 2.19.0 security-mode clusters. For other versions, HTTPS access is forcibly enabled and cannot be disabled. Value range: Default value: false |
|
adminPwd |
No |
String |
Definition: Password of the administrator admin for a security-mode cluster. Constraints: This parameter is mandatory only when authorityEnable is set to true during cluster creation. Value range: A string of 8 to 32 characters. Must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters ~!@#$%&*()-_=|[{}];:,<.>/? Default value: N/A |
|
publicIPReq |
No |
CreateClusterPublicIpReq object |
Definition: Public network access information. Constraints: This parameter is valid only when httpsEnable is set to true. Value range: N/A Default value: N/A |
|
loadBalance |
No |
CreateClusterLoadBalance object |
Definition: VPC endpoint service information. Constraints: N/A Value range: N/A Default value: N/A |
|
publicKibanaReq |
No |
CreateClusterPublicKibanaReq object |
Definition: Kibana public network access information. Constraints: This parameter is valid only when authorityEnable is set to true. Value range: N/A Default value: N/A |
|
ipv6_enable |
No |
Boolean |
Definition: Whether to enable automatic IPv6 address assignment for the cluster. Constraints: N/A Value range:
Default value: false |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
flavorRef |
Yes |
String |
Definition: Name flavor name. For details about the current instance flavor, see the name attribute in Obtaining the Instance Specifications List. Constraints: For details about the current instance flavor, see the name attribute in Obtaining the Instance Specifications List. Value range: N/A Default value: N/A |
|
volume |
Yes |
Definition: Volume information. Constraints: If flavorRef is set to a local disk flavor, leave this parameter blank. Obtain the local disk flavor by referring to the diskrange attribute in Obtaining the Instance Specifications List. Value range: N/A Default value: N/A |
|
|
type |
Yes |
String |
Definition: Node type. Constraints: N/A Value range: [- chinese indicates a Chinese language model. Default value: N/A |
|
instanceNum |
Yes |
Integer |
Definition: Number of instances. Constraints: See the value range. Value range:
Default value: N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
volume_type |
Yes |
String |
Definition: Disk type. Constraints: N/A Value range: Default value: N/A |
|
size |
Yes |
Integer |
Definition: Disk size. Constraints: The value must be greater than 0 and a common multiple of 4 and 10, in GB. Value range: You can obtain the disk size from the diskrange attribute in Obtaining the Instance Specifications List. Default value:
NOTE:
For ess and ess-cold nodes, 100 GB or a larger value is recommended. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
vpcId |
Yes |
String |
Definition: VPC ID, which is used for configuring cluster network. Constraints: N/A Value range: N/A Default value: N/A |
|
netId |
Yes |
String |
Definition: Subnet ID (network ID). Constraints: N/A Value range: N/A Default value: N/A |
|
securityGroupId |
Yes |
String |
Definition: Security group ID. Constraints: N/A Value range: N/A Default value: N/A |
|
ips |
No |
Array of strings |
Definition: Node IP address, which is configured when a cluster is created. Constraints: N/A Value range: Only Elasticsearch and OpenSearch support this parameter. Assign automatically: Private IPv4 addresses will be automatically assigned to cluster nodes. Assign manually: Manually assign private IPv4 addresses to cluster nodes. Before assigning an IP address, click View In-Use IP Address to check IP addresses that are already in use. Default value: N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
key |
Yes |
String |
Definition: Tag key. Constraints: N/A Value range: The value can contain 1 to 36 characters. Only digits, letters, hyphens (-), and underscores (_) are allowed. Default value: N/A |
|
value |
Yes |
String |
Definition: Tag value. Constraints: N/A Value range: The value can contain 0 to 43 characters. It can only contain digits, letters, hyphens (-), and underscores (_). Default value: N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
version |
Yes |
String |
Definition: Version of the CSS cluster engine. For details, see the supported versions in Before You Start. Constraints: N/A Value range: N/A[For a serverless cluster, logs, search, and vector are supported.] (tag:white) Default value: N/A |
|
type |
Yes |
String |
Definition: Engine type of the cluster to be created. Constraints: N/A Value range: Default value: N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
eip |
Yes |
CreateClusterPublicEip object |
Definition: Public network bandwidth. Constraints: N/A Value range: N/A Default value: N/A |
|
elbWhiteListReq |
Yes |
CreateClusterElbWhiteList object |
Definition: EIP whitelist. Constraints: N/A Value range: N/A Default value: N/A |
|
publicBindType |
Yes |
String |
Definition: Whether to automatically bind an EIP. Constraints: N/A Value range: Currently, only auto_assign is supported. Default value: N/A |
|
eipId |
No |
String |
Definition: EIP ID. Constraints: N/A Value range: N/A Default value: N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
bandWidth |
Yes |
CreateClusterPublicEipSize object |
Definition: Set the public network bandwidth. Constraints: N/A Value range: N/A Default value: N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
size |
Yes |
Integer |
Definition: Bandwidth size, in Mbit/s. Constraints: N/A Value range: 1-200 Default value: 1 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
eipSize |
Yes |
Integer |
Definition: Bandwidth size, in Mbit/s. Constraints: N/A Value range: 1-200 Default value: 1 |
|
elbWhiteList |
Yes |
Definition: Kibana whitelist information. Constraints: N/A Value range: N/A Default value: N/A |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
cluster |
CreateClusterResp object |
Definition: Cluster object. For a pay-per-use cluster, only the cluster parameter is returned. Value range: N/A. |
Example Requests
-
Example request for creating a pay-per-use Elasticsearch cluster
POST https://{Endpoint}/v2.0/{project_id}/clusters { "cluster" : { "name" : "css-cluster", "desc" : "Cluster testing", "backupStrategy" : { "period" : "16:00 GMT+08:00", "prefix" : "snapshot", "keepday" : 7, "frequency" : "DAY", "bucket" : "OBS-obsName", "basePath" : "css_repository/obs-path", "agency" : "css_obs_agency", "maxSnapshotBytesPerSeconds" : 40, "maxRestoreBytesPerSeconds" : 40 }, "roles" : [ { "flavorRef" : "ess.spec-4u8g", "volume" : { "volume_type" : "COMMON", "size" : 100 }, "type" : "ess", "instanceNum" : 1 } ], "nics" : { "vpcId" : "{VPC ID}", "netId" : "{NET ID}", "securityGroupId" : "{Security group ID}" }, "enterprise_project_id" : 0, "tags" : [ { "key" : "k1", "value" : "v1" }, { "key" : "k2", "value" : "v2" } ], "availability_zone" : "{Az code}", "datastore" : { "version" : "{cluster-version}", "type" : "elasticsearch" }, "authorityEnable" : true, "httpsEnable" : true, "adminPwd" : "{password}", "publicIPReq" : { "eip" : { "bandWidth" : { "size" : 5 } }, "elbWhiteListReq" : { "enableWhiteList" : true, "whiteList" : "127.0.0.1" }, "publicBindType" : "auto_assign", "eipId" : null }, "loadBalance" : { "endpointWithDnsName" : false, "vpcPermissions" : [ "{Account ID}" ] }, "publicKibanaReq" : { "eipSize" : 5, "elbWhiteList" : { "whiteList" : "127.0.0.1", "enableWhiteList" : true } } } }
Example Responses
Status code: 200
Request succeeded.
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Request succeeded. |
|
400 |
Invalid request. Modify the request before retry. |
|
409 |
The request could not be completed due to a conflict with the current state of the resource. The resource that the client attempts to create already exists, or the update request fails to be processed because of a conflict. |
|
412 |
The server did not meet one of the preconditions contained in the request. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot