CreateMigrateJob

Last updated: 2021-03-02 17:37:27

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 data migration task

This example shows you how to fully migrate the data from a public network MySQL instance in Guangzhou to the 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                        // Execute immediately
&MigrateOption.MigrateType=2                      // Full
&MigrateOption.MigrateObject=1                  // Instance-level 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                        // Migrate a non-Alibaba Cloud instance
&SrcInfo.Password=123456                        // Password of the source instance
&SrcInfo.Region=ap-guangzhou                     // Source instance region: Guangzhou
&DstInfo.InstanceId=cdb-e78e0nnv            // Target instance ID
&DstInfo.Region=ap-shanghai                      // Destination 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"
  }
}

Example2 Creating a direct connect data migration task

This example shows you how to fully and incrementally migrate a Direct Connect-enabled MySQL instance in Guangzhou to the 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                               // Execute immediately
&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