tencent cloud

APIs

ModifyDBInstanceSpec

Download
聚焦模式
字号
最后更新时间: 2026-05-18 17:47:47

1. API Description

Domain name for API request: mongodb.intl.tencentcloudapi.com.

This API is used to adjust the TencentDB for MongoDB instance configuration. The DescribeSpecInfo API can be called to query and obtain the supported sales specifications.

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: ModifyDBInstanceSpec.
Version Yes String Common Params. The value used for this API: 2019-07-25.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
InstanceId Yes String

Instance ID. Log in to the MongoDB console and copy the instance ID from the instance list.

Memory No Integer

Memory size after instance configuration modification. Unit: GB. The current instance memory size is used by default if this parameter is left blank. For supported memory specifications, please refer to product specifications.
Note: Memory and disk configurations should be upgraded or downgraded at the same time, meaning that Memory and Volume should be modified at the same time.

Volume No Integer

Hard disk size after instance configuration modification. Unit: GB. The current instance disk size is used by default if this parameter is left blank. For supported disk capacity, please refer to product specification.

  • Memory and disk configurations should be upgraded or downgraded at the same time, meaning that Memory and Volume should be modified simultaneously.
  • When downgrading, the disk capacity after modification must be greater than 1.2 times the used disk capacity.
NodeNum No Integer

Number of mongod nodes after instance change (excluding read-only nodes).

  • Replica set node count: Use the MinNodeNum and MaxNodeNum parameters in the DescribeSpecInfo API response to obtain the node count range.
  • Number of shard nodes in a sharded cluster: Use the MinReplicateSetNodeNum and MaxReplicateSetNodeNum parameters in the DescribeSpecInfo API response to obtain the node count range.
    Note: When modifying the CPU or memory specifications of mongod or mongos, you may not configure this parameter or enter the current number of mongod or mongos nodes (excluding read-only nodes).
ReplicateSetNum No Integer

Number of shards after instance change.

  • The value range for the number of instance shards can be obtained through the response parameters MinReplicateSetNum and MaxReplicateSetNum of the DescribeSpecInfo API.
  • Only allow adding shards, not reducing them.
InMaintenance No Integer

Switch time for instance configuration change.

  • 0: Immediately execute the configuration modification task upon completion of adjustment. Default is 0.
  • 1: Execute the configuration modification task within the maintenance window.
    Note: Adjusting the number of nodes and shard quantity is unsupported within the maintenance window.
MongosMemory No String

Memory size of mongos after sharding instance configuration change. Unit: GB. For instance support specifications, see product specification.

AddNodeList.N No Array of AddNodeList

List of nodes to be added, containing the node type and AZ information.

RemoveNodeList.N No Array of RemoveNodeList

Delete node list.
Note: Based on the consistency principle of sharded instance nodes, when deleting shard instance nodes, only need to specify the node corresponding to shard 0, for example: cmgo-9nl1czif_0-node-readonly0 will delete the first read-only node of each shard.

Cpu No Integer

CPU size after instance configuration changes. Unit: C. If empty, the default value is the current CPU size of the instance. For currently supported CPU specifications, see Product Specifications.

MachineCode No String

The product specification type after instance configuration change. If empty, the default value is the current instance product specification type.
Currently supported product specification types are as follows:
Recommended product specification types:

  • GE.LD.T1: Local disk (Common I).
  • GE.CD.T1: Cloud disk (Common I).

Product allowlist specification types:

  • HIO10G: Local disk (High IO 10G).
  • HCD: Cloud disk (Cloud Disk Edition).

Note:

  1. Allowlist specification types are controlled by allowlist. If needed, submit a ticket to apply.
  2. Common I cannot be changed to allowlist specification types.

3. Output Parameters

Parameter Name Type Description
DealId String

Order ID.

RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Deleting Secondary Nodes from a TencentDB for MongoDB Instance

This example shows you how to delete 2 secondary nodes in total from Guangzhou Zone 2 and Zone 3. The final number of nodes changes to 3.

Input Example

POST / HTTP/1.1
Host: mongodb.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ModifyDBInstanceSpec
<Common request parameters>

{
    "InstanceId": "cmgo-abcdef",
    "Memory": 4,
    "Volume": 100,
    "OplogSize": 30,
    "NodeNum": 3,
    "ReplicateSetNum": 1,
    "InMaintenance": 1,
    "RemoveNodeList": [
        {
            "NodeName": "cmgo-3iecwbfx_0-node0",
            "Role": "SECONDARY",
            "Zone": "ap-guangzhou-2"
        },
        {
            "NodeName": "cmgo-3iecwbfx_0-node1",
            "Role": "SECONDARY",
            "Zone": "ap-guangzhou-3"
        }
    ]
}

Output Example

{
    "Response": {
        "DealId": "7142863",
        "RequestId": "d88095e5-50e8-4245-a0cf-993a536f9b20"
    }
}

Example2 Adding Secondary Nodes to a TencentDB for MongoDB Instance

This example shows you how to add 2 secondary nodes in total to Guangzhou Zone 2 and Zone 3. The final number of nodes changes to 5.

Input Example

POST / HTTP/1.1
Host: mongodb.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ModifyDBInstanceSpec
<Common request parameters>

{
    "InstanceId": "cmgo-p8vn****",
    "Memory": 4,
    "Volume": 100,
    "OplogSize": 30,
    "NodeNum": 5,
    "ReplicateSetNum": 1,
    "InMaintenance": 1,
    "AddNodeList": [
        {
            "Role": "SECONDARY",
            "Zone": "ap-guangzhou-2"
        },
        {
            "Role": "SECONDARY",
            "Zone": "ap-guangzhou-3"
        }
    ]
}

Output Example

{
    "Response": {
        "DealId": "7142863",
        "RequestId": "d88095e5-50e8-4245-a0cf-993a536f9b20"
    }
}

Example3 Adjusting the Configuration of a TencentDB for MongoDB Instance

This example shows you how to adjust the configuration of a TencentDB for MongoDB instance.

Input Example

POST / HTTP/1.1
Host: mongodb.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ModifyDBInstanceSpec
<Common request parameters>

{
    "InstanceId": "cmgo-p8vn****",
    "Volume": 250,
    "Memory": 4
}

Output Example

{
    "Response": {
        "RequestId": "d88095e5-50e8-4245-a0cf-993a536f9b20",
        "DealId": "7142863"
    }
}

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
InvalidParameter.PermissionDenied The current sub-account has no permission to perform this operation.
InvalidParameter.ZoneClosed Instances are not purchasable in this AZ.
InvalidParameterValue.InvalidTradeOperation Billing error. Corresponding purchase/renewal/configuration change operations are not allowed for the current instance.
InvalidParameterValue.ModifyModeError Memory and disk must be upgraded or degraded simultaneously.
InvalidParameterValue.NotFoundInstance The instance was not found.
InvalidParameterValue.OplogSizeOutOfRange The OplogSize parameter is set incorrectly and should be between 10% and 90% of the disk capacity.
InvalidParameterValue.SetDiskLessThanUsed The disk size to be set cannot be less than 1.2 times the used disk capacity.
InvalidParameterValue.SpecNotOnSale Incorrect purchasable specification.
InvalidParameterValue.StatusAbnormal The instance is in a status where operations are not allowed.

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈