This topic describes how to configure synchronization, migration, and subscription tasks in Data Transmission Service (DTS) by calling operations.
Background information
Configuring DTS tasks by calling operations is similar to configuring DTS tasks in the DTS console. You can purchase a DTS instance first and then configure it, or configure a DTS task first and then purchase an instance.
For DTS tasks where you purchase an instance first and then configure it:
Synchronization or migration tasks: Whether the precheck module is started depends on the value of
autoStartModulesAfterConfigin the Reserve parameter) of the ConfigureDtsJob operation.Subscription tasks: The precheck module is not started by default.
For DTS tasks where you configure a task first and then purchase an instance:
Whether the precheck module is started depends on the value of
AutoStartin the CreateDtsInstance operation.
Usage notes
When you call operations, ensure that parameters are correctly specified. Otherwise, the calls may fail.
When you call operations to purchase a synchronization or migration task first and then configure it, and the precheck module is executed without errors, the DTS task automatically executes all subsequent modules.
Preparations
You need to collect database instance information, such as the ID, region, endpoint or IP address, port, database account, and password of the source database instance.
Procedure
This section uses a migration task as an example to describe how to configure DTS tasks by calling operations.
Scenario 1: Purchase an instance first and then configure it
Do not start the precheck module
Call the CreateDtsInstance operation to purchase a DTS instance.
Sample requests
{ "DestinationEndpointEngineName":"MySQL", "DestinationRegion":"cn-hangzhou", "InstanceClass":"small", "PayType":"PostPaid", "RegionId":"cn-hangzhou", "SourceEndpointEngineName":"MySQL", "SourceRegion":"cn-hangzhou", "Type":"MIGRATION" }Sample responses
{ "RequestId": "76C0****-879D-5FB7-8F08-BC11B67C****", "InstanceId": "dtsza0i4l8x167****", "Success": true, "JobId": "za0i4l8x167****" }Call the ConfigureDtsJob operation to configure a DTS task.
NoteYou need to set the value of
autoStartModulesAfterConfigto none in the Reserve parameter.For subscription tasks, you need to call the ConfigureSubscription operation, and the
autoStartModulesAfterConfigparameter in the Reserve parameter does not take effect.
Sample requests
{ "DataInitialization":"true", "DataSynchronization":"false", "DestinationEndpointInstanceType":"RDS", "DtsJobName":"rdsmysql_to_rdsmysql", "JobType":"MIGRATION", "SourceEndpointInstanceType":"RDS", "StructureInitialization":"true", "DbList":{ "dtsdb":{ "name":"dtsdb_1", "all":"false", "Table":{ "person":{ "name":"person", "all":"true" } } } }, "DestinationEndpointEngineName":"MYSQL", "DestinationEndpointInstanceID":"rm-bp1072qxu5q3h****", "DestinationEndpointPassword":"**********", "DestinationEndpointRegion":"cn-hangzhou", "DestinationEndpointUserName":"dtstest", "DtsInstanceId":"dtsza0i4l8x167****", "RegionId":"cn-hangzhou", "Reserve":{ "targetTableMode":"0", "autoStartModulesAfterConfig":"none" }, "SourceEndpointDatabaseName":"dtsdb", "SourceEndpointEngineName":"MYSQL", "SourceEndpointInstanceID":"rm-bp1072qxu5q3h****", "SourceEndpointPassword":"**********", "SourceEndpointRegion":"cn-hangzhou", "SourceEndpointUserName":"dtstest" }Sample responses
{ "DtsJobId": "za0i4l8x167****", "RequestId": "9233****-9539-5DB7-B801-69AADEB9****", "HttpStatusCode": 200, "DtsInstanceId": "dtsza0i4l8x167****", "Success": true }Optional. Call the StartDtsJob operation to start the DTS task based on your business requirements. Then, the DTS task executes the precheck module and subsequent modules.
Sample requests
{ "DtsJobId":"za0i4l8x167****", "RegionId":"cn-hangzhou" }Sample responses
{ "RequestId": "CE51****-40F3-5913-AA27-C50251E2****", "HttpStatusCode": 200, "Success": true }
Start the precheck module
This case is not applicable to subscription tasks.
Call the CreateDtsInstance operation to purchase a DTS instance.
Sample requests
{ "DestinationEndpointEngineName":"MySQL", "DestinationRegion":"cn-hangzhou", "InstanceClass":"small", "PayType":"PostPaid", "RegionId":"cn-hangzhou", "SourceEndpointEngineName":"MySQL", "SourceRegion":"cn-hangzhou", "Type":"MIGRATION" }Sample responses
{ "RequestId": "63F4****-935A-5E55-A7BC-D0464BA1****", "InstanceId": "dtsdg6e4m0e177****", "Success": true, "JobId": "dg6e4m0e177****" }Call the ConfigureDtsJob operation to configure a DTS task.
NoteYou need to leave the
dulesAfterConfigparameter unspecified or set the value of this parameter to auto in the Reserve parameter.If the precheck module is executed without errors, the DTS task automatically executes all subsequent modules.
Sample requests
{ "DataInitialization":"true", "DataSynchronization":"false", "DestinationEndpointInstanceType":"RDS", "DtsJobName":"rdsmysql_to_rdsmysql_1", "JobType":"MIGRATION", "SourceEndpointInstanceType":"RDS", "StructureInitialization":"true", "DbList":{ "dtsdb":{ "name":"dtsdb_1", "all":"false", "Table":{ "person":{ "name":"person_1", "all":"true" } } } }, "DestinationEndpointEngineName":"MYSQL", "DestinationEndpointInstanceID":"rm-bp1072qxu5q3h****", "DestinationEndpointPassword":"**********", "DestinationEndpointRegion":"cn-hangzhou", "DestinationEndpointUserName":"dtstest", "DtsInstanceId":"dtsdg6e4m0e177****", "RegionId":"cn-hangzhou", "SourceEndpointDatabaseName":"dtsdb", "SourceEndpointEngineName":"MYSQL", "SourceEndpointInstanceID":"rm-bp1072qxu5q3h****", "SourceEndpointPassword":"**********", "SourceEndpointRegion":"cn-hangzhou", "SourceEndpointUserName":"dtstest" }Sample responses
{ "DtsJobId": "za0i4l8x167****", "RequestId": "9233****-9539-5DB7-B801-69AADEB9****", "HttpStatusCode": 200, "DtsInstanceId": "dtsza0i4l8x167****", "Success": true }
Scenario 2: Configure a task first and then purchase an instance
+Do not start the precheck module
Call the ConfigureDtsJob operation to configure a DTS task.
NoteFor subscription tasks, you need to call the ConfigureSubscription operation.
Sample requests
{ "DataInitialization":"true", "DataSynchronization":"false", "DestinationEndpointInstanceType":"RDS", "DtsJobName":"rdsmysql_to_rdsmysql_2", "JobType":"MIGRATION", "SourceEndpointInstanceType":"RDS", "StructureInitialization":"true", "DbList":{ "dtsdb":{ "name":"dtsdb_1", "all":"false", "Table":{ "person":{ "name":"person_2", "all":"true" } } } }, "DestinationEndpointEngineName":"MYSQL", "DestinationEndpointInstanceID":"rm-bp1072qxu5q3h****", "DestinationEndpointPassword":"**********", "DestinationEndpointRegion":"cn-hangzhou", "DestinationEndpointUserName":"dtstest", "RegionId":"cn-hangzhou", "Reserve":{ "targetTableMode":"0", "autoStartModulesAfterConfig":"none" }, "SourceEndpointDatabaseName":"dtsdb", "SourceEndpointEngineName":"MYSQL", "SourceEndpointInstanceID":"rm-bp1072qxu5q3h****", "SourceEndpointPassword":"**********", "SourceEndpointRegion":"cn-hangzhou", "SourceEndpointUserName":"dtstest" }Sample responses
{ "DtsJobId": "w4rg4pj4169****", "RequestId": "F0CC****-A556-5A9D-AFF0-85D2B284****", "HttpStatusCode": 200, "Success": true }Optional. Start the DTS task based on your business requirements. Then, the DTS task executes the precheck module and subsequent modules. For more information, see step 2 and beyond of Start the precheck module without starting the DTS task or Start the precheck module and the DTS task.
Start the precheck module without starting the DTS task
Call the ConfigureDtsJob operation to configure a DTS task.
NoteFor subscription tasks, you need to call the ConfigureSubscription operation.
Sample requests
{ "DataInitialization":"true", "DataSynchronization":"false", "DestinationEndpointInstanceType":"RDS", "DtsJobName":"rdsmysql_to_rdsmysql_3", "JobType":"MIGRATION", "SourceEndpointInstanceType":"RDS", "StructureInitialization":"true", "DbList":{ "dtsdb":{ "name":"dtsdb_1", "all":"false", "Table":{ "person":{ "name":"person_3", "all":"true" } } } }, "DestinationEndpointEngineName":"MYSQL", "DestinationEndpointInstanceID":"rm-bp1072qxu5q3h****", "DestinationEndpointPassword":"**********", "DestinationEndpointRegion":"cn-hangzhou", "DestinationEndpointUserName":"dtstest", "RegionId":"cn-hangzhou", "SourceEndpointDatabaseName":"dtsdb", "SourceEndpointEngineName":"MYSQL", "SourceEndpointInstanceID":"rm-bp1072qxu5q3h****", "SourceEndpointPassword":"**********", "SourceEndpointRegion":"cn-hangzhou", "SourceEndpointUserName":"dtstest" }Sample responses
{ "DtsJobId": "w4rg4pj4169****", "RequestId": "F0CC****-A556-5A9D-AFF0-85D2B284****", "HttpStatusCode": 200, "Success": true }Call the StartDtsJob operation to start the precheck module.
Sample requests
{ "DtsJobId":"w4rg4pj4169****", "RegionId":"cn-hangzhou" }Sample responses
{ "RequestId": "2A54****-4467-520E-B45A-D144A0C8****", "HttpStatusCode": 200, "Success": true }Call the DescribePreCheckStatus operation to check the execution status of the precheck module.
Sample requests
{ "DtsJobId":"w4rg4pj4169****", "JobCode":"01", "RegionId":"cn-hangzhou", "StructType":"before" }Sample responses
If the following information is returned, the precheck module is completed without errors.
{ ****** "AnalysisJobProgress": [], "PageRecordCount": 20, "RequestId": "4436****-EE62-5DC3-8838-30807292****", "FullNetCheckJobStatus": [], "JobName": "****", "ErrorItem": 0, "SubDistributedJobStatus": [], "Code": "01", "Success": true, "PageNumber": 1, "State": "Finished", "Total": 9, "HttpStatusCode": 200, "JobId": "w4rg4pj4169****", ****** }Call the CreateDtsInstance operation to purchase a DTS instance.
NoteYou need to leave the
AutoStartparameter unspecified or set its value to false. In this case, the DTS instance does not execute subsequent modules. This operation is equivalent to clicking Buy and Save in the DTS console.Sample requests
{ "InstanceClass":"small", "JobId":"w4rg4pj4169****", "PayType":"PostPaid", "RegionId":"cn-hangzhou" }Sample responses
{ "RequestId": "63F4****-935A-5E55-A7BC-D0464BA1****", "InstanceId": "dtsgvbn4c28167****", "Success": true, "JobId": "w4rg4pj4169****" }Optional. Call the StartDtsJob operation to start the DTS task based on your business requirements.
Sample requests
{ "DtsJobId":"w4rg4pj4169****", "RegionId":"cn-hangzhou" }Sample responses
{ "RequestId": "EC1F****-10B0-501E-8B3E-71963809****", "HttpStatusCode": 200, "Success": true }
Start the precheck module and the DTS task
Call the ConfigureDtsJob operation to configure a DTS task.
NoteFor subscription tasks, you need to call the ConfigureSubscription operation.
Sample requests
{ "DataInitialization":"true", "DataSynchronization":"false", "DestinationEndpointInstanceType":"RDS", "DtsJobName":"rdsmysql_to_rdsmysql_4", "JobType":"MIGRATION", "SourceEndpointInstanceType":"RDS", "StructureInitialization":"true", "DbList":{ "dtsdb":{ "name":"dtsdb_1", "all":"false", "Table":{ "person":{ "name":"person_4", "all":"true" } } } }, "DestinationEndpointEngineName":"MYSQL", "DestinationEndpointInstanceID":"rm-bp1072qxu5q3h****", "DestinationEndpointPassword":"**********", "DestinationEndpointRegion":"cn-hangzhou", "DestinationEndpointUserName":"dtstest", "RegionId":"cn-hangzhou", "SourceEndpointDatabaseName":"dtsdb", "SourceEndpointEngineName":"MYSQL", "SourceEndpointInstanceID":"rm-bp1072qxu5q3h****", "SourceEndpointPassword":"**********", "SourceEndpointRegion":"cn-hangzhou", "SourceEndpointUserName":"dtstest" }Sample responses
{ "DtsJobId": "etom45sg17e****", "RequestId": "46F2****-69DD-59D7-8FF5-A119D72A****", "HttpStatusCode": 200, "Success": true }Call the StartDtsJob operation to start the precheck module.
Sample requests
{ "DtsJobId":"etom45sg17e****", "RegionId":"cn-hangzhou" }Sample responses
{ "RequestId": "2A54****-4467-520E-B45A-D144A0C8****", "HttpStatusCode": 200, "Success": true }Call the DescribePreCheckStatus operation to check the execution status of the precheck module.
Sample requests
{ "DtsJobId":"etom45sg17e****", "JobCode":"01", "RegionId":"cn-hangzhou", "StructType":"before" }Sample responses
If the following information is returned, the precheck module is completed without errors.
{ ****** "AnalysisJobProgress": [], "PageRecordCount": 20, "RequestId": "4436****-EE62-5DC3-8838-30807292****", "FullNetCheckJobStatus": [], "JobName": "****", "ErrorItem": 0, "SubDistributedJobStatus": [], "Code": "01", "Success": true, "PageNumber": 1, "State": "Finished", "Total": 9, "HttpStatusCode": 200, "JobId": "etom45sg17e****", ****** }Call the CreateDtsInstance operation to purchase a DTS instance.
NoteYou need to set the
AutoStartparameter to true. Then, the DTS instance automatically executes subsequent modules. This operation is equivalent to clicking Buy and Save in the DTS console.Sample requests
{ "AutoStart":"true", "InstanceClass":"small", "JobId":"etom45sg17e****", "PayType":"PostPaid", "RegionId":"cn-hangzhou" }Sample responses
{ "RequestId": "4280****-9D5C-5053-9CA3-FAE47248****", "InstanceId": "dtst7lg4f20178****", "Success": true, "JobId": "etom45sg17e****" }