调用 SwitchDBMaster 接口手动切换目标 MongoDB 实例的主从节点。
异步请求。
InstanceStatus
为 Running
)。关于实例状态的更多详情,请参见实例状态说明。参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
InstanceId | String | 是 | mongo-shard-011d2479**** | 实例 ID。 说明 您可以调用 DescribeDBInstances 接口查询目标地域下所有 MongoDB 实例的基本信息,包括实例 ID。 |
NodeId | String | 是 | mongo-shard-100b2c546f14-s0-1 | 需要进行主从切换的从节点 ID。 说明 必须传入从节点(即 |
本接口无特有的返回参数。更多信息请见返回结构。
手动切换副本集实例的主从节点角色。
POST https://mongodb.volcengineapi.com/?Action=SwitchDBMaster&Version=2022-01-01 HTTP/1.1 Host: mongodb.volcengineapi.com Content-Type: application/json; charset=utf-8 X-Date: 20201103T104027Z Authorization: HMAC-SHA256 Credential=AK****/20201103/cn-beijing/mongodb/request,SignedHeaders=content-type;host;x-date,Signature=**** { "InstanceId": "mongo-replica-c81b6e56****", "NodeId": "mongo-replica-c81b6e56****-1" }
{ "ResponseMetadata": { "RequestId": "202305161612331350F38EC0C05BC2****", "Action": "SwitchDBMaster", "Version": "2022-01-01", "Service": "mongodb", "Region": "cn-beijing" }, "Result": null }
手动切换分片集群实例中某一 Shard 分片的主从节点角色。
POST https://mongodb.volcengineapi.com/?Action=SwitchDBMaster&Version=2022-01-01 HTTP/1.1 Host: mongodb.volcengineapi.com Content-Type: application/json; charset=utf-8 X-Date: 20201103T104027Z Authorization: HMAC-SHA256 Credential=AK****/20201103/cn-beijing/mongodb/request,SignedHeaders=content-type;host;x-date,Signature=**** { "InstanceId": "mongo-shard-100b2c54****", "NodeId": "mongo-shard-100b2c54****-s0-1" }
{ "ResponseMetadata": { "RequestId": "202305161612331350F38EC0C05BC2****", "Action": "SwitchDBMaster", "Version": "2022-01-01", "Service": "mongodb", "Region": "cn-beijing" }, "Result": null }
手动切换分片集群实例中 ConfigServer 的主从节点角色。
POST https://mongodb.volcengineapi.com/?Action=SwitchDBMaster&Version=2022-01-01 HTTP/1.1 Host: mongodb.volcengineapi.com Content-Type: application/json; charset=utf-8 X-Date: 20201103T104027Z Authorization: HMAC-SHA256 Credential=AK****/20201103/cn-beijing/mongodb/request,SignedHeaders=content-type;host;x-date,Signature=**** { "InstanceId": "mongo-shard-100b2c54****", "NodeId": "mongo-shard-100b2c54****-config-0" }
{ "ResponseMetadata": { "RequestId": "202305161612331350F38EC0C05BC2****", "Action": "SwitchDBMaster", "Version": "2022-01-01", "Service": "mongodb", "Region": "cn-beijing" }, "Result": null }
更多详情,请参见错误码。