You can call the ModifyHASwitchConfig operation to enable or disable the automatic primary/secondary switchover feature for an ApsaraDB RDS instance.

After a switchover is complete, the original primary RDS instance runs as the secondary RDS instance. For more information, see Switch workloads over between primary and secondary ApsaraDB RDS for MySQL instances.

Before you call this operation, make sure that the instance does not run the RDS Basic Edition.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ModifyHASwitchConfig

The operation that you want to perform. Set the value to ModifyHASwitchConfig.

DBInstanceId String Yes rm-uf6wjk5xxxxxxxxxx

The ID of the instance.

RegionId String Yes cn-hangzhou

The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list.

HAConfig String No Manual

The status of the automatic primary/secondary switchover feature. Valid values:

  • Auto: The automatic primary/secondary switchover feature is enabled. The system automatically switches your workloads over from the instance to its secondary instance in the event of a fault.
  • Manual: The automatic primary/secondary switchover feature is disabled. You must manually switch your workloads over from the instance to its secondary instance in the event of a fault.

Default value: Auto.

Note If you set this parameter to Manual, you must specify the ManualHATime parameter.
ManualHATime String No 2019-08-29T15:00:00Z

The time after which the automatic primary/secondary switchover feature is enabled. At most, you can set this parameter to 23:59:59 seven days later. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

Note This parameter takes effect only when you set the HAConfig parameter to Manual.

Response parameters

Parameter Type Example Description
RequestId String B6AE1448-D846-4831-B1C7-CFF3E99D5470

The ID of the request.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=ModifyHASwitchConfig
&RegionId=cn-hangzhou
&DBInstanceId=rm-uf6wjk5xxxxxxxxxx
&HAConfig=Manual
&ManualHATime=2019-08-28T15:00:00
&<Common request parameters>

Sample success responses

XML format

<ModifyHASwitchConfigResponse>
   <RequestId>B6AE1448-D846-4831-B1C7-CFF3E99D5470</RequestId>
</ModifyHASwitchConfigResponse>

JSON format

{
    "RequestId": "B6AE1448-D846-4831-B1C7-CFF3E99D5470"
}

Error codes

HTTP status code Error code Error message Description
400 HaConfig.Format The value of HaConfig must be auto or manual The error message returned because the value of the HAConfig parameter is invalid. The HAConfig parameter must be set to Auto or Manual.
400 HaConfigIsNull HaConfig is null. The error message returned because the value of the HAConfig parameter is Null.

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