CreateMigrateJob

Last updated: 2020-06-24 10:53:19

1. API Description

Domain name for API request: dts.tencentcloudapi.com.

This API (CreateMigrateJob) is used to create a data migration task.

For a finance zone linkage, please use the domain name dts.ap-shenzhen-fsi.tencentcloudapi.com.

A maximum of 20 requests can be initiated per second for this API.

Note: This API supports Finance regions. If the common parameter Region is a Finance region, a domain name with the Finance region needs to be specified, for example: dts.ap-shanghai-fsi.tencentcloudapi.com

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common parameter. The value used for this API: CreateMigrateJob.
Version Yes String Common parameter. The value used for this API: 2018-03-30.
Region Yes String Common parameter. For more information, please see the list of regions supported by the product.
JobName Yes String Data migration task name
MigrateOption Yes MigrateOption Migration task configuration options
SrcDatabaseType Yes String Source instance database type, which currently supports MySQL, Redis, MongoDB, PostgreSQL, MariaDB, and Percona. For more information on the supported types in a specific region, see the migration task creation page in the console.
SrcAccessType Yes String Source instance access type. Valid values: extranet (public network), cvm (CVM-based self-created instance), dcg (Direct Connect-enabled instance), vpncloud (Tencent Cloud VPN-enabled instance), cdb (TencentDB instance), ccn (CCN instance)
SrcInfo Yes SrcInfo Source instance information, which is correlated with the migration task type
DstDatabaseType Yes String Target instance access type, which currently supports MySQL, Redis, MongoDB, PostgreSQL, MariaDB, and Percona. For more information on the supported types in a specific region, see the migration task creation page in the console.
DstAccessType Yes String Target instance access type, which currently only supports cdb (TencentDB instance)
DstInfo Yes DstInfo Destination instance information
DatabaseInfo No String Information of the source table to be migrated, which is described in JSON string format. It is required if MigrateOption.MigrateObject is 2 (migrating the specified table).
For databases with a database-table structure:
[{Database:db1,Table:[table1,table2]},{Database:db2}]
For databases with a database-schema-table structure:
[{Database:db1,Schema:s1
Table:[table1,table2]},{Database:db1,Schema:s2
Table:[table1,table2]},{Database:db2,Schema:s1
Table:[table1,table2]},{Database:db3},{Database:db4
Schema:s1}]

3. Output Parameters

Parameter Name Type Description
JobId String Data migration task ID
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Creating public network-based migration task for RDS

This example shows you how to migrate an RDS 5.6 instance fully and incrementally over the public network.

Input Example

https://dts.tencentcloudapi.com/?Action=CreateMigrateJob
&JobName=usertest                                    // DTS task name
&SrcDatabaseType=mysql                                // Source instance type: MySQL
&SrcAccessType=extranet                              // Migration over the public network
&DstDatabaseType=mysql                               // Target instance type: MySQL
&DstAccessType=cdb                                   // Target instance type: TencentDB for MySQL
&MigrateOption.RunMode=1                               // Immediate execution
&MigrateOption.MigrateType=3                          // Full + incremental migration
&MigrateOption.MigrateObject=1                       // Entire instance
&MigrateOption.ConsistencyType=5                       // No check
&SrcInfo.AccessKey=cdb-powiqx8q                         // Alibaba Cloud AccessKey
&SrcInfo.RdsInstanceId=rm-uf546i98x6ngqjnjx              // Alibaba Cloud RDS instance ID
&SrcInfo.Ip=106.13.216.14
&SrcInfo.Port=3306
&SrcInfo.User=root                                   // Source instance username
&SrcInfo.Supplier=aliyun                             // Alibaba Cloud instance migration
&SrcInfo.Password=123456                               // Source instance password
&SrcInfo.Region=ap-guangzhou                           // Source instance region: Guangzhou
&DstInfo.InstanceId=cdb-d0dqi8nv                      // Target instance ID
&DstInfo.Region=ap-shanghai                          // Target region: Shanghai
&<Common request parameters>

Output Example

{
  "Response": {
    "JobId": "dts-p01oy6qp",
    "RequestId": "2fcd891c-32f4-bf82-a8c0-16c99d75e175"
  }
}

Example2 Creating Direct Connect-based data migration task

This example shows you how to fully and incrementally migrate a Direct Connect-based MySQL instance in Guangzhou to the TencentDB for MySQL instance cdb-d0dqi8nv in Shanghai and spot check the data consistency.

Input Example

https://dts.tencentcloudapi.com/?Action=CreateMigrateJob
&JobName=usertest                                    // DTS task name
&SrcDatabaseType=mysql                               // Source instance type: MySQL
&SrcAccessType=dcg                                   // Migration over the public network
&DstDatabaseType=mysql                                  // Target instance type: MySQL
&DstAccessType=cdb                                   // Target instance type: TencentDB for MySQL
&MigrateOption.RunMode=1                               // Immediate execution
&MigrateOption.MigrateType=3                          // Full + incremental migration
&MigrateOption.MigrateObject=1                          // Entire instance migration
&MigrateOption.ConsistencyType=3                        // Spot check
&MigrateOption.ConsistencyParams.SelectRowsPerTable=10    // Randomly select 20% of tables and 10% of entries in each table for data content verification
&MigrateOption.ConsistencyParams.TablesSelectAll=20
&MigrateOption.ConsistencyParams.TablesSelectCount=30     // Randomly select 30% of tables for record entry verification, i.e., `Select count(*)`
&MigrateOption.IsOverrideRoot=0             // Do not overwrite the target database with source database root account
&SrcInfo.UniqDcgId=dcg-cyrjcc09                      // Direct Connect gateway ID
&SrcInfo.VpcId=vpc-72jblfaa                           // VPC ID
&SrcInfo.SubnetId=subnet-7raec42a                   // Subnet ID
&SrcInfo.Ip=192.168.120.136                         // Source instance IP
&SrcInfo.Port=3307                                  // Source instance port
&SrcInfo.User=root                                  // Source instance username
&SrcInfo.Supplier=others                            // Non-Alibaba Cloud instance migration
&SrcInfo.Password=123456                            // Source instance password
&SrcInfo.Region=ap-guangzhou                          // Source instance region: Guangzhou
&DstInfo.InstanceId=cdb-d0dqi8nv                       // Target instance ID
&DstInfo.Region=ap-shanghai                             // Target region: Shanghai
&DstInfo.ReadOnly=1                                 // The target instance is read-only
&<Common request parameters>

Output Example

{
  "Response": {
    "JobId": "dts-o3s1vxsp",
    "RequestId": "915bc42a-714f-4faa-915b-a51cc09f5714"
  }
}

Example3 Creating TencentDB migration task

This example shows you how to perform structural migration of selected tables from one TencentDB for MySQL instance to another instance without performing data consistency check.

Input Example

https://dts.tencentcloudapi.com/?Action=CreateMigrateJob
&JobName=usertest                                    // DTS task name
&SrcDatabaseType=mysql                                // Source instance type: MySQL
&SrcAccessType=cdb                                   // TencentDB migration
&DstDatabaseType=mysql                               // Target instance type: MySQL
&DstAccessType=cdb                                   // Target instance type: TencentDB for MySQL
&MigrateOption.RunMode=1                               // Immediate execution
&MigrateOption.MigrateType=1                          // Structural migration
&MigrateOption.MigrateObject=2                       // Migration of specified tables
&DatabaseInfo=[{"Database":"test","Table":["user","log"]}]    // Table to be migrated
&MigrateOption.ConsistencyType=5                       // No check
&SrcInfo.InstanceId=cdb-powiqx8q                     // Source instance ID
&SrcInfo.User=root                                   // Source instance username
&SrcInfo.Supplier=others                             // Non-Alibaba Cloud instance migration
&SrcInfo.Password=123456                               // Source instance password
&SrcInfo.Region=ap-guangzhou                           // Source instance region: Guangzhou
&DstInfo.InstanceId=cdb-d0dqi8nv                      // Target instance ID
&DstInfo.Region=ap-shanghai                          // Target region: Shanghai
&<Common request parameters>

Output Example

{
  "Response": {
    "JobId": "dts-46i7easd",
    "RequestId": "bc94c57b-9d69-11e9-84cb-256e968056b0"
  }
}

Example4 Creating public network-based data migration task

This example shows you how to fully migrate the data from a public network MySQL instance in Guangzhou to the TencentDB for MySQL instance cdb-e78e0nnv in Shanghai and perform a full data consistency check.

Input Example

https://dts.tencentcloudapi.com/?Action=CreateMigrateJob
&JobName=usertest                               // DTS task name
&SrcDatabaseType=mysql                          // Source instance type: MySQL
&SrcAccessType=extranet                         // Migration over the public network
&DstDatabaseType=mysql                          // Target instance type: MySQL
&DstAccessType=cdb                                   // Target instance access type: TencentDB for MySQL
&MigrateOption.RunMode=1                        // Immediate execution
&MigrateOption.MigrateType=2                      // Full
&MigrateOption.MigrateObject=1                  // Entire instance migration
&MigrateOption.ConsistencyType=2                // Full data consistency check
&MigrateOption.IsOverrideRoot=0            // Do not overwrite the target database with source database root account
&SrcInfo.Ip=14.17.22.36                         // Public IP of source instance
&SrcInfo.Port=10301                             // Public port of source instance 
&SrcInfo.User=root                              // Source instance username
&SrcInfo.Supplier=others                        // Non-Alibaba Cloud instance migration
&SrcInfo.Password=123456                        // Source instance password
&SrcInfo.Region=ap-guangzhou                     // Source instance region: Guangzhou
&DstInfo.InstanceId=cdb-e78e0nnv                // Target instance ID
&DstInfo.Region=ap-shanghai                     // Target region: Shanghai
&DstInfo.ReadOnly=1                             // The target instance is read-only
&<Common request parameters>

Output Example

{
  "Response": {
    "JobId": "dts-1kl0iy0v",
    "RequestId": "2201c42a-714f-4faa-915b-a51cc09f5cec"
  }
}

5. Developer Resources

API Explorer

This tool allows online call, signature authentication, SDK code generation and quick search of APIs to greatly improve the efficiency of using TencentCloud APIs.

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation.NotAllowOperation This operation is prohibited.
InternalError.DatabaseError Failed to access the database on the DTS platform.
InternalError.DuplicateJob Migration tasks are in conflict.
InternalError.ProtocolError Communication protocol error.
InvalidParameter Invalid parameter.
LimitExceeded.MaxUnusedJobs The number of idle migration tasks exceeds the limit.
UnauthorizedOperation.NotEnoughPrivileges Verification failed. Insufficient permissions.

Was this page helpful?

Was this page helpful?

  • Not at all
  • Not very helpful
  • Somewhat helpful
  • Very helpful
  • Extremely helpful
Send Feedback
Help