跳到主要内容

任务预检(基础)

接口描述

任务信息基础校验,包括可连接性基本参数权限

接口地址

/cloudcanal/console/api/v1/openapi/datajob/precheckbasic

请求方式

POST

请求参数

参数名称参数说明请求类型是否必须数据类型
clusterId链接数据源的集群idbodylong
srcDsId源端数据源idbodylong
srcHostType源数据源host类型

PRIVATE
PUBLIC
bodyString
srcSchema源端库表描述,见示例bodyString
dstDsId目标数据源idbodylong
dstHostType目标数据源host类型

PRIVATE
PUBLIC
bodyString
dstSchema目标库表描述,可由 srcSchema 配合 mappingDef 计算得出,可为空bodyString
mappingDef库表映射,见示例bodyString
jobType任务类型,可通过 获取任务类型 接口查询获取bodyString
initialSync如果是数据同步任务,是否需要初始化数据(全量迁移)bodyBoolean
shortTermNum如果有短期同步,持续多少天bodyint
shortTermSync如果是数据迁移任务,是否需要短期同步bodyBoolean
specId规格idbodyint
fullPeriod是否是周期性全量迁移bodyBoolean
fullPeriodCronExpr周期性全量迁移 CronTab 表达式bodyString
autoStart是否自动启动bodyBoolean
checkOnce增量追上后是否做一次全量数据校验bodyBoolean
checkPeriod是否是周期性校验bodyBoolean
checkPeriodCronExpr周期性校验 CronTab 表达式bodyString

srcSchema 说明 (MySQL)

不同数据源 schema 存在不同的字段描述,需要更多源端数据源可找产品团队咨询

参数名称参数说明请求类型是否必须数据类型
db映射方法

DB_DB
SCHEMA_SCHEMA
TABLE_TABLE
COLUMN_COLUMN
DB_SCHEMA
SCHEMA_DB
DB_TOPIC
TABLE_TOPIC
TOPIC_TABLE
TOPIC_INDEX
ANY_DB
TABLE_INDEX
TABLE_KEYPREFIX
bodyString
dbPattern嵌套多层映射关系,根据 method 或 parent 为空进行识别bodyString
tables该数据库所拥有的表bodyString
targetAutoCreate对端是否需要自动创建bodyString
inBlackList是否在黑名单(不同步或者迁移数据)bodyString
[
{
"db": "dingtax",
"dbPattern": "",
"tables": [],
"targetAutoCreate": false,
"inBlackList": false
}
]

mappingDef 说明

mappingDef 为一个数组,每一个组代表一种映射

参数名称参数说明请求类型是否必须数据类型
method映射方法

DB_DB
SCHEMA_SCHEMA
TABLE_TABLE
COLUMN_COLUMN
DB_SCHEMA
SCHEMA_DB
DB_TOPIC
TABLE_TOPIC
TOPIC_TABLE
TOPIC_INDEX
ANY_DB
TABLE_INDEX
TABLE_KEYPREFIX
bodyString
serializeMapping嵌套多层映射关系,根据 method 或 parent 为空进行识别bodyString
serializeAutoGenRules指定映射规则bodyString
commonGenRule通用映射规则bodyString

mappingDef 示例(MySQL -> PostgreSQL)

[
{
"method": "DB_SCHEMA",
"serializeMapping": {
"{\"value\":\"dingtax\"}": "{\"parent\":{\"value\":\"dingtax_target\"},\"value\":\"public\"}"
},
"serializeAutoGenRules": {},
"commonGenRule": "MIRROR"
},
{
"serializeMapping": {},
"method": "TABLE_TABLE",
"serializeAutoGenRules": {},
"commonGenRule": "MIRROR"
},
{
"method": "COLUMN_COLUMN",
"serializeMapping": {},
"serializeAutoGenRules": {},
"commonGenRule": "MIRROR"
}
]

公共响应结果

参数名称参数说明类型(java)不为空
code1:成功 0:失败string
dataobject
msgstring
requestIdstring

data 参数说明

data 是一个数组,数组里面每一项表示一个检查项,检查项参数说明如下

参数名称参数说明类型(java)不为空
title测试项名称Long
passRequirement测试项通过需要的条件String
varName参数名称String
varRequireValues参数需要符合的值String
varActualValue参数实际值String
preCheckType校验类型
CONNECTIVITY(可连接性)
VERSION(版本)
BINLOG_EXISTENCE(增量日志是否存在)
PRIVILEGES(权限)
STRUCT_TABLE_STORAGE(表存储)
STRUCT_TABLE_PK(主键)
STRUCT_TABLE_CHARSET(表字符集)
STRUCT_TABLE_COLLATION(表校验集)
STRUCT_TABLE_FK(外键)
STRUCT_EXISTENCE(库表列是否存在)
VARIABLES(数据库参数)
SPEC_SCHEDULE_SUPPORT(容量是否足够)
INCREMENT_BALANCE(增量license)
FULL_BALANCE(全量任务license)
CHECK_BALANCE(校验任务license)
STRUCT_BALANCE(结构迁移license)
NAME_LENGTH(元数据名字长度)
INDEX_COLUMN(索引列)
COLUMN_TYPE(列类型)
VERSION_COMPATIBILITY(版本兼容度)
String
success该项是否预检成功String
checked该项是否已经预检int
contextDbName检查所关联的dbint
contextTableName检查所关联的表String
contextColumnName检查所关联的列String

响应示例

{
"requestId": "422622b9-2bf5-11ec-8b3e-172e4c81a5c3",
"code": "1",
"msg": "request success",
"data": [
{
"title": "源端数据库连接测试",
"passRequirement": "数据库能被链接上",
"varName": null,
"varRequireValues": null,
"varActualValue": null,
"preCheckType": "CONNECTIVITY",
"success": true,
"checked": true,
"contextDbName": null,
"contextTableName": null,
"contextColumnName": null
},
{
"title": "源端数据库版本检查",
"passRequirement": "支持5.1.x,5.5.x,5.6.x,5.7.x,8.x MySQL",
"varName": null,
"varRequireValues": null,
"varActualValue": null,
"preCheckType": "VERSION",
"success": true,
"checked": true,
"contextDbName": null,
"contextTableName": null,
"contextColumnName": null
},
{
"title": "PRECHECK_PRIVS_SOURCE_SELECT_TITLE",
"passRequirement": "需要有数据库dingtax select权限",
"varName": null,
"varRequireValues": [
"select"
],
"varActualValue": null,
"preCheckType": "PRIVILEGES",
"success": true,
"checked": true,
"contextDbName": null,
"contextTableName": null,
"contextColumnName": null
},
{
"title": "参数'log_bin'检查",
"passRequirement": "'log_bin'参数值必须为 1",
"varName": "log_bin",
"varRequireValues": [
"1"
],
"varActualValue": "1",
"preCheckType": "VARIABLES",
"success": true,
"checked": true,
"contextDbName": null,
"contextTableName": null,
"contextColumnName": null
},
{
"title": "参数'binlog_format'检查",
"passRequirement": "'binlog_format'参数值必须为'ROW'",
"varName": "binlog_format",
"varRequireValues": [
"ROW"
],
"varActualValue": "ROW",
"preCheckType": "VARIABLES",
"success": true,
"checked": true,
"contextDbName": null,
"contextTableName": null,
"contextColumnName": null
},
{
"title": "参数'binlog_row_image'检查",
"passRequirement": "'binlog_row_image'参数值必须为'FULL'",
"varName": "binlog_row_image",
"varRequireValues": [
"FULL"
],
"varActualValue": "FULL",
"preCheckType": "VARIABLES",
"success": true,
"checked": true,
"contextDbName": null,
"contextTableName": null,
"contextColumnName": null
},
{
"title": "'replication client'权限检查",
"passRequirement": "需要有'replication client'权限",
"varName": null,
"varRequireValues": [
"replication client"
],
"varActualValue": null,
"preCheckType": "PRIVILEGES",
"success": true,
"checked": true,
"contextDbName": null,
"contextTableName": null,
"contextColumnName": null
},
{
"title": "'replication slave'权限检查",
"passRequirement": "需要有'replication slave'权限",
"varName": null,
"varRequireValues": [
"replication slave"
],
"varActualValue": null,
"preCheckType": "PRIVILEGES",
"success": true,
"checked": true,
"contextDbName": null,
"contextTableName": null,
"contextColumnName": null
},
{
"title": "任务规格可用性预检",
"passRequirement": "您添加的机器的剩余可用内存需要满足所选任务的规格",
"varName": null,
"varRequireValues": null,
"varActualValue": null,
"preCheckType": "SPEC_SCHEDULE_SUPPORT",
"success": true,
"checked": true,
"contextDbName": null,
"contextTableName": null,
"contextColumnName": null
}
]
}