You need to enable JavaScript to run this app.
导航
CreateTransmissionTask
最近更新时间:2024.06.07 17:49:48首次发布时间:2023.03.29 20:39:53

调用 CreateTransmissionTask 接口创建数据库传输服务任务。

请求类型

同步请求。

请求参数

名称类型是否必选示例值描述

TaskName

String

Test****

任务名称。命名规则:

  • 以字母开头且不能为空。

  • 长度需在 64 个字符内。

  • 只能包含字母、数字、下划线(_)和中划线(-)。

TaskType

String

DataMigration

任务类型。取值如下:

  • DataMigration:表示创建数据迁移任务。

  • DataSubscription:表示创建数据订阅任务。

  • DataSynchronization:表示创建数据同步任务。

SrcConfig

DataSource

{
    "EndpointType": "Public_MySQL",
    "PublicMySQLSettings": {
    "Host": "192.168.***.***",
    "Port": 4,
    "Username": "test****",
    "Password": "Admin@****",
    "SSLSettings": {
            "EnableSSL": "true",
            "Cert": "-----BEGIN CERTIFICATE----- ...... -----END CERTIFICATE-----"
        },
    "RegionSettings": {
            "Region": "cn-shanghai"
        }
    }
}

源库信息。详细信息,请参见 DataSource

DestConfig

DataSource

{
    "EndpointType": "Volc_MySQL",
    "VolcMySQLSettings": {
    "DBInstanceId": "mysql-7cd1dc4ab511",
    "DBInstanceName": "",
    "Password": "Admin@****",
    "RegionSettings": {
            "Region": "cn-guangzhou"
        },
    "Username": "test****"
    }
}

目标库信息。详细信息,请参见 DataSource

SolutionSettings

SolutionSetting

{
    "MySQL2MySQLSettings": {
        "AccountTransmissionSettings": {
             "EnableAccount": true
         },
         "ETLSettings": {
             "Script": ""
         },
         "ErrorBehaviorSettings": {
             "MaxRetrySeconds": 7200
         },
         "FullTransmissionSettings": {
             "EnableFull": true,
             "Snapshot": false
         },
         "IncrTransmissionSettings": {
             "EnableIncr": true,
             "Statements": [
                     "StmtDDLAll",
                     "StmtDMLDelete",
                     "StmtDMLUpdate",
                     "StmtDMLInsert"
                 ]
         },
         "MetaTransmissionSettings": {
             "EnableMeta": true
         },
         "ObjectMappings": [
             {
                 "DestObjName": "huahua",
                 "MappingList": [
                         {
                             "DestObjName": "*",
                             "ObjectType": "Table",
                             "SrcObjName": "*"
                         }
                 ],
                 "ObjectType": "Database",
                 "SrcObjName": "huahua"
             }
         ],
         "PolicyForPrimaryKeyConflict": "Override",
         "AccountMapping": {
               "Account": "test****",
               "ResetPassword": "true",
               "Password": "*Test****"
             }
     },
     "SolutionType": "MySQL2MySQL"
 }
```,

迁移、订阅或同步任务对象的配置信息。详细信息,请参见 SolutionSetting

TrafficSpecStringCompact任务链路规格。支持 CompactStandard 取值。默认值为 Compact。关于链路规格的详细信息,请参见产品规格

ChargeConfig

ChargeConfig

{
    "ChargeType":"PostPaid"
}

计费配置。详细信息,请参见 ChargeConfig

ProjectName

String

default

项目名称。

说明

您可以调用 GetProject 接口创建项目。

CreateBackwardSyncTask

Bool

false

是否创建反向同步任务。取值如下:

  • true:表示创建反向同步任务。

  • false:表示不创建反向同步任务,默认值。

说明

数据同步功能支持多种同步拓扑,您可以根据业务需求选择合适的拓扑进行数据同步。更多信息,请参见同步拓扑

Tags

Array of Tag

[
    {
        "Key": "key1",
        "Value": "value1"
    }
]

标签信息。说明支持一次传入多组标签键值对像,多组标签键值对像间用英文逗号(,)分隔。最多同时传入 20 组标签键值对。单个任务最多可绑定 50 个键值。详细信息,请参见 Tag

返回参数

名称类型示例值描述
TaskIdStringaf16a602e1134abdbb281864ca******任务 ID。

请求示例

POST /?Action=CreateTransmissionTask&Version=2022-10-01 HTTP/1.1
Content-Type: application/json
Host:dts.volcengineapi.com
X-Date: 20221001T101010Z
Authorization: HMAC-SHA256 Credential=AKLTN2I0MmFiNzMxNWE5NDgzMzk4MmVjMTVkODlkZTZ****/20221001/cn-beijing/dts/request,SignedHeaders=x-date, Signature=71d31fc7bcf990142851c9833c5656391486cda0ae2e0b8ada733b7c645****

{
    "TaskName": "zaizaitest****1",
    "TaskType": "DataMigration",
    "SrcConfig": {
        "EndpointType": "Public_MySQL",
        "PublicMySQLSettings": {
            "Host": "192.168.***.***",
            "Port": 4,
            "Username": "test****",
            "Password": "Admin@****",
            "SSLSettings": {
                "EnableSSL": "true",
                "Cert": "-----BEGIN CERTIFICATE----- ...... -----END CERTIFICATE-----"
            },
            "RegionSettings": {
                "Region": "cn-shanghai"
            }
        }
    },
    "DestConfig": {
        "EndpointType": "Volc_MySQL",
        "VolcMySQLSettings": {
            "DBInstanceId": "mysql-7cd1dc4ab511",
            "DBInstanceName": "",
            "Password": "Admin@****",
            "RegionSettings": {
                "Region": "cn-guangzhou"
            },
            "Username": "test****"
        }
    },
    "TrafficSpec": "Compact",
    "ProjectName": "default",
    "SolutionSettings": {
        "MySQL2MySQLSettings": {
            "AccountTransmissionSettings": {
                "EnableAccount": true
            },
            "ETLSettings": {
                "Script": ""
            },
            "ErrorBehaviorSettings": {
                "MaxRetrySeconds": 7200
            },
            "FullTransmissionSettings": {
                "EnableFull": true,
                "Snapshot": false
            },
            "IncrTransmissionSettings": {
                "EnableIncr": true,
                "Statements": [
                    "StmtDDLAll",
                    "StmtDMLDelete",
                    "StmtDMLUpdate",
                    "StmtDMLInsert"
                ]
            },
            "MetaTransmissionSettings": {
                "EnableMeta": true
            },
            "ObjectMappings": [
                {
                    "DestObjName": "huahua",
                    "MappingList": [
                        {
                            "DestObjName": "*",
                            "ObjectType": "Table",
                            "SrcObjName": "*"
                        }
                    ],
                    "ObjectType": "Database",
                    "SrcObjName": "huahua"
                }
            ],
            "PolicyForPrimaryKeyConflict": "Override",
            "AccountMapping": {
                "Account": "test****",
                "ResetPassword": "true",
                "Password": "*Test****"
            }
        },
        "SolutionType": "MySQL2MySQL"
    },
    "Tags": [
        {
            "Key": "key1",
            "Value": "value1"
        }
    ],
    "ChargeConfig": {
        "ChargeType": "PostPaid"
    }
}

返回示例

{
    "ResponseMetadata": {
        "RequestId": "2023032015110930FCAD0A8CC67B0EAB33",
        "Action": "CreateTransmissionTask",
        "Version": "2022-10-01",
        "Service": "dts",
        "Region": "cn-beijing"
    },
    "Result": {
        "TaskId": "af16a602e1134abdbb281864ca*****"
    }
}

错误码

更多详情,请参见错误码