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.
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 Params. The value used for this API: CreateMigrateJob. |
Version | Yes | String | Common Params. The value used for this API: 2018-03-30. |
Region | Yes | String | Common Params. 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, Percona, and SQL Server. 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, SQL Server, and TDSQL-C for MySQL. 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"}] |
Tags.N | No | Array of TagItem | Tag of the instance to be migrated. |
SrcNodeType | No | String | Source instance type. simple : Primary/Secondary node; cluster : Cluster node. If this field is left empty, the value defaults to primary/secondary node. |
SrcInfoMulti.N | No | Array of SrcInfo | Source instance information, which is correlated with the migration task type. |
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. |
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.
POST / HTTP/1.1
Host: dts.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateMigrateJob
<Common request parameters>
{
"JobName": "Set an identifiable name",
"SrcDatabaseType": "mysql",
"SrcAccessType": "extranet",
"SrcInfo": {
"Supplier": "others",
"Ip": "14.17.22.36",
"Region": "ap-guangzhou",
"User": "root",
"Password": "yourPassword",
"Port": 3306
},
"DstDatabaseType": "mysql",
"DstAccessType": "cdb",
"DstInfo": {
"InstanceId": "cdb-e78e0nnv",
"Region": "ap-shanghai",
"ReadOnly": 0,
"User": "root",
"Password": "yourPassword"
},
"DatabaseInfo": "[]",
"Tags": [
{
"TagKey": "Owner",
"TagValue": "bob"
}
],
"MigrateOption": {
"ExternParams": "{}",
"MigrateObject": 1,
"RunMode": 1,
"ExpectTime": "2020-09-22 00:00:00",
"ConsistencyType": 2,
"MigrateType": 2,
"IsOverrideRoot": 0
}
}
{
"Response": {
"JobId": "dts-1kl0iy0v",
"RequestId": "2201c42a-714f-4faa-915b-a51cc09f5cec"
}
}
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.
POST / HTTP/1.1
Host: dts.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateMigrateJob
<Common request parameters>
{
"JobName": "Set an identifiable name",
"SrcDatabaseType": "mysql",
"SrcAccessType": "dcg",
"SrcInfo": {
"Supplier": "others",
"UniqDcgId": "dcg-cyrjcc09",
"VpcId": "vpc-72jblfaa",
"SubnetId": "subnet-7raec42a",
"Ip": "192.168.120.136",
"Region": "ap-guangzhou",
"User": "root",
"Password": "yourPassword",
"Port": 3306
},
"DstDatabaseType": "mysql",
"DstAccessType": "cdb",
"DstInfo": {
"InstanceId": "cdb-d0dqi8nv",
"Region": "ap-shanghai",
"ReadOnly": 0,
"User": "root",
"Password": "yourPassword"
},
"DatabaseInfo": "[{\"Database\":\"test\",\"Table\":[\"user\",\"log\"]}]",
"Tags": [
{
"TagKey": "Owner",
"TagValue": "bob"
}
],
"MigrateOption": {
"ExternParams": "{}",
"MigrateObject": 1,
"RunMode": 1,
"ExpectTime": "2020-09-22 00:00:00",
"ConsistencyType": 2,
"MigrateType": 2,
"IsOverrideRoot": 0
}
}
{
"Response": {
"JobId": "dts-o3s1vxsp",
"RequestId": "915bc42a-714f-4faa-915b-a51cc09f5714"
}
}
This example shows you how to perform structural migration of selected tables from one MySQL instance to another MySQL instance on Tencent Cloud without performing data consistency check.
POST / HTTP/1.1
Host: dts.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateMigrateJob
<Common request parameters>
{
"JobName": "Set an identifiable name",
"SrcDatabaseType": "mysql",
"SrcAccessType": "cdb",
"SrcInfo": {
"Supplier": "others",
"InstanceId": "cdb-ieow93923",
"User": "root",
"Password": "yourPassword"
},
"DstDatabaseType": "mysql",
"DstAccessType": "cdb",
"DstInfo": {
"InstanceId": "cdb-e78e0nnv",
"Region": "ap-shanghai",
"ReadOnly": 0,
"User": "root",
"Password": "yourPassword"
},
"DatabaseInfo": "[]",
"Tags": [
{
"TagKey": "Owner",
"TagValue": "bob"
}
],
"MigrateOption": {
"ExternParams": "{}",
"MigrateObject": 1,
"RunMode": 1,
"ExpectTime": "2020-09-22 00:00:00",
"ConsistencyType": 5,
"MigrateType": 2,
"IsOverrideRoot": 0
}
}
{
"Response": {
"JobId": "dts-46i7easd",
"RequestId": "bc94c57b-9d69-11e9-84cb-256e968056b0"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Error Code | Description |
---|---|
AuthFailure.UnauthorizedOperationError | The current user is not allowed to perform this operation as the authentication failed. |
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. |
InternalError.UnknownError | Unknown internal error. |
InvalidParameter | A parameter error occurred. |
InvalidParameter.BizInvalidParameterValueError | Parameter value error. |
LimitExceeded.MaxUnusedJobs | The number of idle migration tasks exceeds the limit. |
UnauthorizedOperation.NotEnoughPrivileges | Verification failed. Insufficient permissions. |
Was this page helpful?