tencent cloud

文档反馈

CreateClusters

最后更新时间:2023-08-23 14:23:03

1. API Description

Domain name for API request: cynosdb.tencentcloudapi.com.

This API is used to create a cluster.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreateClusters.
Version Yes String Common Params. The value used for this API: 2019-01-07.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
Zone Yes String AZ
VpcId Yes String VPC ID
SubnetId Yes String Subnet ID
DbType Yes String Database type. Valid values:
  • MYSQL
  • DbVersion Yes String Database version. Valid values:
  • Valid values for MYSQL: 5.7 and 8.0
  • ProjectId No Integer Project ID.
    Cpu No Integer It is required when DbMode is set to NORMAL or left empty.
    Number of CPU cores of normal instance
    Memory No Integer It is required when DbMode is set to NORMAL or left empty.
    Memory of a non-serverless instance in GB
    Storage No Integer This parameter has been deprecated.
    Storage capacity in GB
    ClusterName No String Cluster name, which can contain less than 64 letters, digits, or symbols (-_.).
    AdminPassword No String Account password, which must contain 8-64 characters in at least three of the following four types: uppercase letters, lowercase letters, digits, and symbols (~!@#$%^&*_-+=`|(){}[]:;'<>,.?/).
    Port No Integer Port. Valid range: [0, 65535). Default value: 3306
    PayMode No Integer Billing mode. 0: pay-as-you-go; 1: monthly subscription. Default value: 0
    Count No Integer Number of purchased clusters. Valid range: [1,50]. Default value: 1
    RollbackStrategy No String Rollback type:
    noneRollback: no rollback;
    snapRollback: rollback by snapshot;
    timeRollback: rollback by time point
    RollbackId No Integer snapshotId for snapshot rollback or queryId for time point rollback. 0 indicates to determine whether the time point is valid
    OriginalClusterId No String The source cluster ID passed in during rollback to find the source poolId
    ExpectTime No String Specified time for time point rollback or snapshot time for snapshot rollback
    ExpectTimeThresh No Integer This parameter has been deprecated.
    Specified allowed time range for time point rollback
    StorageLimit No Integer Storage upper limit of normal instance in GB
    If DbType is MYSQL and the storage billing mode is monthly subscription, the parameter value can’t exceed the maximum storage corresponding to the CPU and memory specifications.
    InstanceCount No Integer Number of Instances. Valid range: (0,16]
    TimeSpan No Integer Purchase duration of monthly subscription plan
    TimeUnit No String Duration unit of monthly subscription. Valid values: s, d, m, y
    AutoRenewFlag No Integer Whether auto-renewal is enabled for monthly subscription plan. Default value: 0
    AutoVoucher No Integer Whether to automatically select a voucher. 1: yes; 0: no. Default value: 0
    HaCount No Integer Number of instances (this parameter has been disused and is retained only for compatibility with existing instances)
    OrderSource No String Order source
    ResourceTags.N No Array of Tag Array of tags to be bound to the created cluster
    DbMode No String Database type
    Valid values when DbType is MYSQL (default value: NORMAL):
  • NORMAL
  • SERVERLESS
  • MinCpu No Float This parameter is required if DbMode is SERVERLESS.
    Minimum number of CPU cores. For the value range, see the returned result of DescribeServerlessInstanceSpecs.
    MaxCpu No Float This parameter is required if DbMode is SERVERLESS.
    Maximum number of CPU cores. For the value range, see the returned result of DescribeServerlessInstanceSpecs.
    AutoPause No String This parameter specifies whether the cluster will be automatically paused if DbMode is SERVERLESS. Valid values:
  • yes
  • no

  • Default value: yes
    AutoPauseDelay No Integer This parameter specifies the delay for automatic cluster pause in seconds if DbMode is SERVERLESS. Value range: [600,691200]
    Default value: 600
    StoragePayMode No Integer The billing mode of cluster storage. Valid values: 0 (pay-as-you-go), 1 (monthly subscription). Default value: 0.
    If DbType is MYSQL and the billing mode of cluster compute is pay-as-you-go (or the DbMode is SERVERLESS), the billing mode of cluster storage must be pay-as-you-go.
    Clusters with storage billed in monthly subscription can’t be cloned or rolled back.
    SecurityGroupIds.N No Array of String Array of security group IDs
    AlarmPolicyIds.N No Array of String Array of alarm policy IDs
    ClusterParams.N No Array of ParamItem Array of parameters. Valid values: character_set_server (utf8|latin1|gbk|utf8mb4), lower_case_table_names. 0: case-sensitive; 1: case-insensitive).
    DealMode No Integer Transaction mode. Valid values: 0 (place and pay for an order), 1 (place an order)
    ParamTemplateId No Integer Parameter template ID, which can be obtained by querying parameter template information “DescribeParamTemplates”
    SlaveZone No String Multi-AZ address
    InstanceInitInfos.N No Array of InstanceInitInfo Instance initialization configuration information, which is used to select instances with different specifications when purchasing a cluster.

    3. Output Parameters

    Parameter Name Type Description
    TranId String Freezing transaction ID
    Note: This field may return null, indicating that no valid values can be obtained.
    DealNames Array of String Order ID
    Note: This field may return null, indicating that no valid values can be obtained.
    ResourceIds Array of String List of resource IDs (This field has been deprecated. You need to use dealNames in the DescribeResourcesByDealName API to get resource IDs.)
    Note: This field may return null, indicating that no valid values can be obtained.
    ClusterIds Array of String List of cluster IDs (This field has been deprecated. You need to use dealNames in the DescribeResourcesByDealName API to get cluster IDs.)
    Note: This field may return null, indicating that no valid values can be obtained.
    BigDealIds Array of String Big order ID
    Note: This field may return null, indicating that no valid values can be obtained.
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Creating a cluster

    This example shows you how to create a cluster.

    Input Example

    POST / HTTP/1.1
    Host: cynosdb.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CreateClusters
    <Common request parameters>
    
    {
        "Count": 1,
        "StoragePayMode": "0",
        "VpcId": "vpc-1ptuei0b",
        "Zone": "ap-guangzhou-3",
        "AdminPassword": "passwd@admin",
        "DbType": "MYSQL",
        "ProjectId": "0",
        "DbVersion": "10.0",
        "Storage": 100,
        "PayMode": "0",
        "ClusterName": "newInstance",
        "StorageLimit": "100",
        "RollbackStrategy": "noneRollback",
        "Memory": "4",
        "SubnetId": "subnet-1tmw9t4o",
        "Cpu": 2,
        "HaCount": "1"
    }
    

    Output Example

    {
        "Response": {
            "ResourceIds": [
                "cynosdbmysql-ins-67rmucgk"
            ],
            "RequestId": "132075",
            "TranId": "20190522160000003106844584180998",
            "ClusterIds": [
                "cynosdbmysql-sls-9nts65r2"
            ],
            "BigDealIds": [
                "xxx"
            ],
            "DealNames": [
                "20190522112283"
            ]
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    FailedOperation.CreateOrder Failed to create the order and make a payment.
    FailedOperation.InsufficientBalance Insufficient account balance
    FailedOperation.OperationFailedError Operation failed. Try again later. If the problem persists, contact customer service.
    FailedOperation.QuerySpecBySpecCodeError Failed to query specifications.
    FailedOperation.TradeCreateOrderError Failed to create the order and make a payment. Please try again later. If the problem persists, please contact customer service.
    InternalError.DbOperationFailed Failed to query the database.
    InternalError.GetSubnetFailed Failed to get the subnet.
    InternalError.GetVpcFailed Failed to get the VPC.
    InternalError.InternalHttpServerError An exception occurred while executing the HTTP request.
    InternalError.UnknownError Unknown internal error.
    InvalidParameterValue.DBTypeNotFound Unsupported instance type.
    InvalidParameterValue.IllegalPassword The password does not meet the requirement.
    InvalidParameterValue.InvalidDBVersion Invalid instance version.
    InvalidParameterValue.InvalidParameterValueError Invalid parameter value.
    InvalidParameterValue.InvalidSpec Invalid instance specification.
    InvalidParameterValue.InvalidZoneIdError Invalid AZ
    InvalidParameterValue.ProjectIdNotFound The ProjectId was not found.
    InvalidParameterValue.RegionZoneUnavailable The selected region and AZ are unavailable.
    InvalidParameterValue.SubnetNotFound The selected subnet could not be found.
    InvalidParameterValue.VpcNotFound The selected VPC could not be found.
    LimitExceeded.UserInstanceLimit The number of instances exceeds the limit.
    OperationDenied.InsufficientBalanceError Insufficient account balance.
    OperationDenied.UserNotAuthenticatedError You need to verify your identity to make a purchase.
    UnauthorizedOperation.NotRealNameAccount Users who haven't completed identity verification can’t make purchases.
    UnauthorizedOperation.PermissionDenied CAM authentication failed.
    联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持