Performs a master-replica switchover to switch node roles. This feature is applicable to disaster recovery drills and nearby access to applications that are deployed across zones.
To call this operation, the ApsaraDB for Redis instance must be of Community Edition or Enhanced Edition (performance-enhanced instances or hybrid-storage instances).
After you call this operation:
- The data nodes may change to the read-only state and become disconnected for a few seconds. Make sure that your applications are configured to automatically reconnect to the instance.
- If an instance enters the Switching state, you cannot manage this instance. For example, you cannot modify the instance configurations or migrate the instance to another zone.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | SwitchInstanceHA |
The operation that you want to perform. Set the value to SwitchInstanceHA. |
InstanceId | String | Yes | r-bp1zxszhcgatnx**** |
The ID of the instance. You can call the DescribeInstances operation to obtain instance IDs. |
SwitchType | String | Yes | AvailablePriority |
The switching mode. Valid values:
Note You must evaluate the requirements for data and services based on your business scenarios,
and select a switching mode.
|
RegionId | String | No | cn-hangzhou |
The ID of the region where the instance is deployed. You can call the DescribeRegions operation to query region IDs. |
NodeId | String | No | r-bp1zxszhcgatnx****db-0,r-bp1zxszhcgatnx****db-1 |
The ID of the data node. Separate multiple IDs with commas (,). Note
|
SwitchMode | Integer | No | 0 |
The time when the switchover is performed. Valid values:
Note You can call the ModifyInstanceMaintainTime operation to modify the maintenance window of an ApsaraDB for Redis instance.
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 5D622714-AEDD-4609-9167-F5DDD3D1**** |
The ID of the request. |
Examples
Sample requests
http(s)://r-kvstore.aliyuncs.com/? Action=SwitchInstanceHA
&InstanceId=r-bp1zxszhcgatnx****
&SwitchType=AvailablePriority
&<Common request parameters>
Sample success responses
XML
format
<DeleteShardingNodeResponse>
<RequestId>5D622714-AEDD-4609-9167-F5DDD3D1****</RequestId>
</DeleteShardingNodeResponse>
JSON
format
{
"RequestId": "5D622714-AEDD-4609-9167-F5DDD3D1****"
}
Error codes
For a list of error codes, visit the API Error Center.