tencent cloud

文档反馈

ConfigureSyncJob

最后更新时间:2024-12-04 15:34:14

    1. API Description

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

    This API is used to configure a sync task.

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

    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 Params. The value used for this API: ConfigureSyncJob.
    Version Yes String Common Params. The value used for this API: 2021-12-06.
    Region Yes String Common Params. For more information, please see the list of regions supported by the product.
    JobId Yes String Sync task instance ID in the format of sync-werwfs23, which is used to identify a sync task.
    SrcAccessType Yes String Source database access type. Valid values: cdb (database); cvm (self-build on CVM); vpc (VPC); extranet (public network); vpncloud (VPN access); dcg (Direct Connect); ccn (CCN); intranet (intranet). Note that the valid values are subject to the current link.
    DstAccessType Yes String Target database access type. Valid values: cdb (database); cvm (self-build on CVM); vpc (VPC); extranet (public network); vpncloud (VPN access); dcg (Direct Connect); ccn (CCN); intranet (intranet); ckafka (CKafka instance). Note that the valid values are subject to the current link.
    Objects Yes Objects Information of synced database/table objects
    JobName No String Sync task name
    JobMode No String Enumerated values: liteMode: Lite mode; fullMode: Standard mode
    RunMode No String Running mode. Valid values: Immediate, Timed. Default value: Immediate.
    ExpectRunTime No String Expected start time in the format of "2006-01-02 15:04:05", which is required if RunMode is Timed.
    SrcInfo No Endpoint Source database information. This parameter only applies to single-node databases, and SrcNodeType must be single.
    SrcInfos No SyncDBEndpointInfos Source database information. This parameter is valid for multi-node databases, and the value of SrcNodeType must be cluster.
    SrcNodeType No String Enumerated values: single (for single-node source database), cluster (for multi-node source database).
    DstInfo No Endpoint Target database information. This parameter is used by single-node databases.
    DstInfos No SyncDBEndpointInfos Target database information. This parameter is valid for multi-node databases, and the value of DstNodeType must be cluster.
    DstNodeType No String Enumerated values: single (for single-node target database), cluster (for multi-node target database).
    Options No Options Sync task options. The RateLimitOption option cannot take effect currently. To modify the speed limit settings, use the ModifySyncRateLimit API.
    AutoRetryTimeRangeMinutes No Integer Automatic retry time, which can be set to 5-720 minutes. 0 indicates that retry is disabled.

    3. Output Parameters

    Parameter Name Type Description
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Configuring a sync task

    This example shows you how to configure a task of syncing an entire database.

    Input Example

    POST / HTTP/1.1
    Host: dts.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: ConfigureSyncJob
    <Common request parameters>
    
    {
        "DstInfo": {
            "Ip": "9.123.210.46",
            "Password": "Test1234",
            "User": "root",
            "Port": 30654
        },
        "SrcInfo": {
            "Ip": "9.123.211.23",
            "Password": "Test1234",
            "User": "root",
            "Port": "30645"
        },
        "ExpectRunTime": "0000-00-00 00:00:01",
        "DstAccessType": "noProxy",
        "JobName": "truexu-api",
        "RunMode": "Immediate",
        "Objects": {
            "Mode": "Partial",
            "Databases": [
                {
                    "DbName": "db1",
                    "DbMode": "All",
                    "TableMode": "All",
                    "Tables": null,
                    "ViewMode": "All",
                    "Views": null,
                    "FunctionMode": "All",
                    "TriggerMode": "",
                    "EventMode": "",
                    "ProcedureMode": "All",
                    "Functions": null,
                    "Procedures": null,
                    "Events": null,
                    "Triggers": null
                }
            ]
        },
        "JobId": "sync-7r1cz016",
        "Options": {
            "DealOfExistSameTable": "ExecuteAfterIgnore",
            "OpTypes": [
                "Update"
            ],
            "DdlOptions": [
                {
                    "DdlObject": "Database",
                    "DdlValue": [
                        "Create",
                        "Alter"
                    ]
                }
            ],
            "InitType": "Full",
            "ConflictHandleOption": {
                "ConditionColumn": "ts",
                "ConditionOperator": ">",
                "ConditionOrderInSrcAndDst": "<"
            }
        },
        "SrcAccessType": "noProxy"
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "8d495a08-5f8f-411b-ae4d-cc6da2475b9c"
        }
    }
    

    Example2 Configuring a sync task 2

    This example shows you how to configure a sync task that supports conditional overwriting.

    Input Example

    POST / HTTP/1.1
    Host: dts.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: ConfigureSyncJob
    <Common request parameters>
    
    {
        "DstInfo": {
            "Ip": "100.88.178.199",
            "Password": "Test1234",
            "User": "root",
            "Port": 20152
        },
        "SrcInfo": {
            "Ip": "100.88.166.23",
            "Password": "Test1234",
            "User": "root",
            "Port": "20126"
        },
        "ExpectRunTime": "2021-12-08 11:59:05",
        "DstAccessType": "noProxy",
        "JobName": "truex",
        "RunMode": "Immediate",
        "Objects": {
            "Mode": "Partial",
            "Databases": [
                {
                    "Tables": [
                        {
                            "FilterCondition": "id>1",
                            "TableName": "tb1",
                            "NewTableName": "tb2"
                        }
                    ],
                    "Views": [
                        {
                            "ViewName": "vw1",
                            "NewViewName": "vw2"
                        }
                    ],
                    "DbName": "db1",
                    "ViewMode": "Partial",
                    "TableMode": "Partial",
                    "DbMode": "Partial"
                }
            ]
        },
        "JobId": "sync-31t047r6",
        "Options": {
            "DdlOptions": [
                {
                    "DdlObject": "Database",
                    "DdlValue": [
                        "Drop"
                    ]
                }
            ],
            "ConflictHandleType": "ReportError",
            "DealOfExistSameTable": "ReportErrorAfterCheck",
            "ConflictHandleOption": {
                "ConditionColumn": "ts",
                "ConditionOperator": ">",
                "ConditionOrderInSrcAndDst": ">"
            },
            "InitType": "Full",
            "OpTypes": [
                "Insert",
                "Update"
            ],
            "AddAdditionalColumn": "false"
        },
        "SrcAccessType": "noProxy"
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "59dd9972-00e7-4ce3-8f33-72d13bc64400"
        }
    }
    

    5. Developer Resources

    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
    InternalError.InternalHttpServerError An HTTP access request error occurred.
    InternalError.UnknownError An unknown internal error occurred.
    InvalidParameterValue.InvalidParameterValueError The parameter is invalid.
    OperationDenied.OperationDeniedError The operation was denied.
    ResourceNotFound.ResourceNotFoundError The resource was not found.