更新时间:2025-09-05 GMT+08:00

批量测试连接

功能介绍

批量测试连接。

接口约束

  • 任务创建成功之后,任务状态为CONFIGURATION才能进行测试连接。

URI

POST /v3/{project_id}/jobs/batch-connection

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

租户在某一Region下的Project ID。

获取方法请参见获取项目ID

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

Content-Type

String

指定类型为application/json。

缺省值:application/json

X-Auth-Token

String

从IAM服务获取的用户Token。

X-Language

String

请求语言类型。

缺省值:en-us

取值:

  • en-us
  • zh-cn
表3 请求Body参数

参数

是否必选

参数类型

描述

jobs

Array of objects

批量测试连接请求列表。

详情请参见表4

表4 jobs字段数据结构说明

参数

是否必选

参数类型

描述

id

String

DRS任务ID,可以从任务列表或者任务详情页面获取。

net_type

String

网络类型。取值:

  • vpn
  • vpc
  • eip

db_type

String

数据库类型。取值:

  • mysql:MySQL
  • mongodb:MongoDB
  • postgresql:PostgreSQL
  • oracle:Oracle

ip

String

数据库IP。

db_port

Integer

数据库端口,Mongo、DDS必填为0。

inst_id

String

数据库实例ID。数据库为云上实例时,比如RDS实例时必填。

db_user

String

数据库账号。

db_password

String

数据库密码。

ssl_link

Boolean

是否SSL安全连接,该参数为true时,需填写SSL证书相关信息参数。

ssl_cert_key

String

SSL证书内容,获取SSL证书后将内容通过BASE64加密后所得的字符串,ssl_link为true时必填。

ssl_cert_name

String

SSL证书名字,ssl_link为true时必填。

ssl_cert_check_sum

String

SSL证书内容checksum值,获取SSL证书后将内容经过SHA256加密后的值,后端校验,ssl_link为true时必填。

ssl_cert_password

String

SSL证书密码,证书文件后缀为.p12,需要密码。

vpc_id

String

数据库所在虚拟私有云ID,网络类型为VPC时必填。

subnet_id

String

数据库所在子网ID,网络类型为VPC时必填。

end_point_type

String

源库:so,目标库:ta。

缺省值:so

取值:

  • so
  • ta

region

String

数据库实例所在Region,数据库为云上实例时,比如RDS实例时必填。

project_id

String

用户所处Region的Project ID。

db_name

String

数据库用户名,DDS的账号认证数据库。

响应参数

状态码: 200

表5 响应Body参数

参数

参数类型

描述

results

Array of objects

批量测试连接响应体集合。

详情请参见表6

count

Integer

总记录数。

表6 results字段数据结构说明

参数

参数类型

描述

id

String

任务ID。

status

String

测试结果。取值:

  • success:表示成功。
  • failed:表示失败。

error_code

String

错误码。

error_msg

String

错误信息。

success

Boolean

是否成功。

请求示例

  • DDS实时迁移任务,目标库为DDS实例测试连接
    https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-connection
    
    {
      "jobs" : [ {
        "id" : "140b5236-88ad-43c8-811c-1268453jb101",
        "ip" : "192.168.4.66:8635,192.168.4.83:8635",
        "net_type" : "eip",
        "db_type" : "mongodb",
        "db_port" : 0,
        "db_user" : "root",
        "db_password" : "********",
        "inst_id" : "3cadd5a0ef724f55ac7fa5bcb5f4fc5fin02",
        "project_id" : "0549a6a31000d4e82fd1c00c3d6f2d76",
        "region" : "region-1",
        "end_point_type" : "ta"
      } ]
    }
  • MySQL实时迁移任务,目标库为RDS for MySQL测试连接
    https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-connection
    
    {
      "jobs" : [ {
        "id" : "140b5236-88ad-43c8-811c-1268453jb101",
        "ip" : "192.168.0.131",
        "net_type" : "eip",
        "db_type" : "mysql",
        "db_port" : 3306,
        "db_user" : "root",
        "db_password" : "********",
        "inst_id" : "e05a3679efe241d8b5dee80b17c1a863in01",
        "project_id" : "054ba152d480d55b2f5dc0069e7ddef0",
        "region" : "region-1",
        "end_point_type" : "ta"
      } ]
    }
  • MySQL实时迁移任务,源库为非RDS实例测试连接
    https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-connection
    
    {
      "jobs" : [ {
        "id" : "140b5236-88ad-43c8-811c-1268453jb101",
        "ip" : "192.168.0.27",
        "net_type" : "eip",
        "db_type" : "mysql",
        "db_port" : 3306,
        "db_user" : "root",
        "db_password" : "********",
        "ssl_link" : false,
        "end_point_type" : "so"
      } ]
    }
  • MySQL-Kafka实时同步任务,Kafka认证方式为PLAINTEXT
    https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-connection
    
    {
      "jobs": [
        {
          "id": "3bc38fe4-da50-4aad-903e-5db76d8jb20i",
          "ip": "xxxxxxx:xxxx",
          "net_type": "eip",
          "db_type": "kafka",
          "project_id": "5237e10fe9aa4ad5b16b6a5245248314",
          "end_point_type": "ta",
          "kafka_security_config": {
            "type": "PLAINTEXT"
          }
        }
      ]
    }
  • MySQL-Kafka实时同步任务,Kafka认证方式为SASL_PLAINTEXT
    https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-connection
    
    {
      "jobs": [
        {
          "id": "3bc38fe4-da50-4aad-903e-5db76d8jb20i",
          "ip": "xxxxxxx:xxxx",
          "net_type": "eip",
          "db_type": "kafka",
          "db_user": "xxxxxxx",
          "db_password": "xxxxxxx",
          "project_id": "5237e10fe9aa4ad5b16b6a5245248314",
          "end_point_type": "ta",
          "kafka_security_config": {
            "type": "SASL_PLAINTEXT",
            "sasl_mechanism": "PLAIN"
          }
        }
      ]
    }
  • MySQL-Kafka实时同步任务,Kafka认证方式为SSL
    https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-connection
    
    {
      "jobs": [
        {
          "id": "3bc38fe4-da50-4aad-903e-5db76d8jb20i",
          "ip": "xxxxxxx:xxxx",
          "net_type": "eip",
          "db_type": "kafka",
          "project_id": "5237e10fe9aa4ad5b16b6a5245248314",
          "end_point_type": "ta",
          "kafka_security_config": {
            "type": "SSL",
            "trust_store_key_name": "client.truststore.jks",
            "trust_store_key": "xxxxxx",
            "trust_store_password": "xxxxxx",
            "endpoint_algorithm": "",
            "enable_key_store": false
          }
        }
      ]
    }
  • MySQL-Kafka实时同步任务,Kafka认证方式为SASL_SSL
    https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-connection
    
    {
      "jobs": [
        {
          "id": "3bc38fe4-da50-4aad-903e-5db76d8jb20i",
          "ip": "xxxxxxx:xxxx",
          "net_type": "eip",
          "db_type": "kafka",
          "db_user": "xxxxxxx",
          "db_password": "xxxxxxx",
          "project_id": "5237e10fe9aa4ad5b16b6a5245248314",
          "end_point_type": "ta",
          "kafka_security_config": {
            "type": "SSL",
            "trust_store_key_name": "client.truststore.jks",
            "trust_store_key": "xxxxxx",
            "trust_store_password": "xxxxxx",
            "endpoint_algorithm": "",
            "enable_key_store": false
          }
        }
      ]
    }

响应示例

状态码: 200

OK

{
  "results" : [ {
    "success" : true,
    "id" : "140b5236-88ad-43c8-811c-1268453jb101",
    "status" : "success"
  } ],
  "count" : 1
}

状态码

状态码

描述

200

OK

400

Bad Request

错误码

请参见错误码