After you perform a primary/secondary switchover on the source or destination database, you can call the SwitchSynchronizationEndpoint operation to transfer the connection settings to Data Transmission Service (DTS). DTS will restart the data synchronization task from the breakpoint.

  • If the source or destination database is a self-managed MySQL database connected over the Internet, Elastic Compute Service (ECS) or Express Connect, you must call this operation to update the connection settings.
  • If the source or destination database is hosted on an ApsaraDB instance (such as ApsaraDB RDS instance and ApsaraDB for MongoDB instance), DTS automatically updates the connection settings. You do not need to call this operation.
    Note
    • For two-way synchronization tasks, if you perform a primary/secondary switchover on the source or destination database, you must call this operation twice to update the connection settings.

      For example, if you perform a primary/secondary switchover on the destination database of the forward direction, you must call this operation twice. In the first call, set the SynchronizationDirection parameter to Forward, set the Endpoint.Type parameter to Destination, and configure the connection settings. In the second call, set the SynchronizationDirection parameter to Reverse, set the Endpoint.Type parameter to Source, and configure the connection settings.

Debugging

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

Request parameters

Parameter Type Required Example Description
Action String Yes SwitchSynchronizationEndpoint

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

Endpoint.InstanceId String Yes i-bp11haem1kpkhoup****

The ID of the ECS instance or the virtual private cloud (VPC).

Note
  • If the Endpoint.InstanceType parameter is set to ECS, you must specify the ID of the ECS instance.
  • If the Endpoint.InstanceType parameter is set to Express, you must specify the ID of the VPC.
Endpoint.InstanceType String Yes ECS

The instance type of the database. Valid values:

  • LocalInstance: self-managed database with a public IP address
  • ECS: self-managed database that is hosted on ECS
  • Express: self-managed database that is connected over Express Connect
Endpoint.Port String Yes 3306

The service port number of the database.

Endpoint.Type String Yes Destination

Specifies whether to update the connection settings of the source instance or the destination instance. Valid values:

  • Source
  • Destination
SynchronizationJobId String Yes dtsexjk1alb116****

The ID of the data synchronization instance. You can call the DescribeSynchronizationJobs operation to query the instance ID.

RegionId String No cn-hangzhou

The ID of the region where the data synchronization instance resides. For more information, see List of supported regions.

SynchronizationDirection String No Forward

The synchronization direction. Valid values:

  • Forward
  • Reverse
Note Default value: Forward.

The value Reverse takes effect only if the topology of the data synchronization instance is two-way synchronization.

Endpoint.IP String No 172.15.185.***

The IP address of the database.

Note You must specify the IP address only if the Endpoint.InstanceType parameter is set to Express.
SourceEndpoint.OwnerID String No 14069264****

The ID of the Alibaba Cloud account to which the source instance belongs. You must specify this parameter only if the source instance and the destination instance belong to different Alibaba Cloud accounts.

SourceEndpoint.Role String No ram-for-dts

The authorized Resource Access Management (RAM) role of the source instance. You must specify the RAM role only if the source instance and the destination instance belong to different Alibaba Cloud accounts. You can use the RAM role to allow the Alibaba Cloud account that owns the destination instance to access the source instance.

Note For information about the permissions and authorization methods of the RAM role, see Configure RAM authorization for cross-account data migration and synchronization.
AccountId String No 12323344****

The ID of the Alibaba Cloud account. You do not need to specify this parameter because this parameter will be removed in the future.

Response parameters

Parameter Type Example Description
ErrCode String InternalError

The error code returned if the call failed.

ErrMessage String The request processing has failed due to some unknown error.

The error message returned if the call failed.

RequestId String 3232F84C-C961-4811-B014-4EA7A27C****

The ID of the request.

Success String true

Indicates whether the call was successful.

TaskId String 11****

The task ID. You must specify the task ID when you call the DescribeEndpointSwitchStatus operation to query the execution status of the task.

Examples

Sample requests

http(s)://dts.aliyuncs.com/?Action=SwitchSynchronizationEndpoint
&Endpoint.InstanceId=i-bp11haem1kpkhoup****
&Endpoint.InstanceType=ECS
&Endpoint.Port=3306
&Endpoint.Type=Destination
&SynchronizationJobId=dtsexjk1alb116****
&<Common request parameters>

Sample success responses

XML format

<SwitchSynchronizationEndpointResponse>
      <RequestId>3232F84C-C961-4811-B014-4EA7A27C****</RequestId>
      <Success>true</Success>
      <TaskId>11****</TaskId>
</SwitchSynchronizationEndpointResponse>

JSON format

{
    "SwitchSynchronizationEndpointResponse": {
        "RequestId": "3232F84C-C961-4811-B014-4EA7A27C****",
        "Success": true,
        "TaskId": "11****"
    }
}

Error codes

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