You can call this operation to switch between the master and slave instances.

This operation switches between the master and slave instances for ApsaraDB for RDS High-Availability Edition. After switching, the slave instance becomes master and carries all business traffic.

Debugging

You can use OpenAPI Explorer to perform debugging. OpenAPI Explorer allows you to perform various operations to simplify API usage. For example, you can retrieve APIs, call APIs, and dynamically generate SDK example code.

Request parameters

Parameter Type Required Example Description
Action String Yes SwitchDBInstanceHA

The operation that you want to perform. Set this parameter to SwitchDBInstanceHA.

DBInstanceId String Yes rm-uf6wjk5xxxxxxxxxx

The ID of the instance.

NodeId String Yes 349054

The unique ID of the slave instance. You can call the DescribeDBInstanceHAConfig API operation to view the ID of the slave instance.

Force String No No

Indicates whether to turn on the forcible switch. Valid values:

  • Yes
  • No

Default value: No

EffectiveTime String No Immediate

The time when the switch takes effect. Valid values:

  • Immediate: The switch takes effect immediately.
  • MaintainTime: The switch takes effect during the maintenance time.

Default value: Immediate.

AccessKeyId String No LTAIfCxxxxxxxxxx

The AccessKey ID that Alibaba Cloud issues to a user for service access.

Response parameters

Parameter Type Example Description
RequestId String 1E43AAE0-BEE8-43DA-860D-EAF2AA0724DC

The ID of the request.

Examples

Sample requests


http(s)://rds.aliyuncs.com/? Action=SwitchDBInstanceHA
&DBInstanceId=rm-uf6wjk5xxxxxxxxxx
&NodeId=349054
&<Common request parameters>

Successful response examples

XML format

<SwitchDBInstanceHAResponse>
	  <RequestId>1E43AAE0-BEE8-43DA-860D-EAF2AA0724DC</RequestId></SwitchDBInstanceHAResponse>

JSON format

{
	"RequestId":"1E43AAE0-BEE8-43DA-860D-EAF2AA0724DC"
}

Error codes

For a list of error codes, visit the API Error Center.