Switches the primary zone of a PolarDB cluster.

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

ParameterTypeRequiredExampleDescription
ActionStringYesModifyDBClusterPrimaryZone

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

DBClusterIdStringYespc-**************

The ID of the cluster.

Note You can call the DescribeDBClusters operation to query information about all your PolarDB clusters that are deployed in a specified region. The returned information includes the ID of each cluster.
ZoneIdStringYescn-hangzhou-g

The ID of the destination primary zone.

Note You can call the DescribeRegions operation to query available zones.
VSwitchIdStringNovsw-**************

The vSwitch ID of in the destination primary zone.

Note
  • This parameter is required if your cluster is a PolarDB for PostgreSQL(Compatible with Oracle) cluster or a PolarDB for PostgreSQL cluster.
  • If your cluster is a PolarDB for PostgreSQL cluster:
    • this parameter is optional if no vSwitches have been created in the destination zone. The default vSwitch is used.
    • this parameter is required if a vSwitch has been created in the destination zone.
PlannedStartTimeStringNo2021-01-14T09:00:00Z

The earliest time to switch the primary zone within the scheduled time period. Specify the parameter in the YYYY-MM-DDThh:mm:ssZ format. The time must be in UTC.

Note
  • The earliest start time of the task can be a point in time within the next 24 hours. For example, if the current time is 2021-01-14T09:00:00Z, you can specify a point in the time range from 2021-01-14T09:00:00Z to 2021-01-15T09:00:00Z.
  • If this parameter is empty, the primary zone is immediately switched.
PlannedEndTimeStringNo2021-01-14T09:30:00Z

The latest start time to run the task. Specify the time in the YYYY-MM-DDThh:mm:ssZ format. The time must be in UTC.

Note
  • The value of this parameter must be at least 30 minutes later than the value of the PlannedStartTime parameter.
  • If you specify the PlannedStartTime parameter but do not specify a value for the PlannedEndTime parameter, the latest start time of the task is set to a value that is calculated by the value of the PlannedEndTime parameter + 30 minutes by default. For example, if you set the PlannedStartTime parameter to 2021-01-14T09:00:00Z and you do not specify the PlannedEndTime parameter, the latest start time of the task is set to 2021-01-14T09:30:00Z.
FromTimeServiceBooleanNofalse

Specify an immediate or scheduled task to switch the primary zone. Default value: false. Valid values:

  • false: scheduled task
  • true: immediate task

Response parameters

ParameterTypeExampleDescription
RequestIdStringED12C6FF-3261-4571-AB57-3570F6******

The ID of the request.

Examples

Sample requests

http(s)://polardb.aliyuncs.com/?Action=ModifyDBClusterPrimaryZone
&DBClusterId=pc-**************
&ZoneId=cn-hangzhou-g
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ModifyDBClusterPrimaryZoneResponse>
<RequestId>ED12C6FF-3261-4571-AB57-3570F6******</RequestId>
</ModifyDBClusterPrimaryZoneResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "ED12C6FF-3261-4571-AB57-3570F6******"
}

Error codes

HTTP status codeError codeError messageDescription
400ScheduleTaskExistThe specified cluster already has a scheduled task.The error code returned because a different task is scheduled to run on the specified cluster.
404InvalidDBCluster.NotFoundThe DBClusterId provided does not exist in our records.The error message returned because the specified DBClusterId does not exist in the current record.

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