Skip to main content

Create Replication Task

Creates a one-way or bidirectional replication task and configures schema replication, full replication, incremental replication, conflict strategy, specification, and object scope.

Request URL: /openapi/v1/replication/create

Request Method: POST

Request Parameters

ParameterTypeRequiredDescriptionExample
nameStringYesReplication task name.replication_demo
sourceDatasourceTypeStringYesSource data source type.mongodb
sourceDatasourceIdStringYesSource data source ID. You can query it by calling List Data Sources.ds-source001
targetDatasourceTypeStringYesTarget data source type.mongodb
targetDatasourceIdStringYesTarget data source ID. You can query it by calling List Data Sources.ds-target001
createTypeStringNoCreation mode. See Create Type Values. The default value is one_way.one_way
existingReplicationIdStringNoExisting replication task ID. Required when createType is bidirectional_from_existing.rp-deddhxp65zbp
replicationOptionObjectYesReplication task options. See replicationOption Fields.See the example below
objectConfigObjectYesReplication object scope. See objectConfig Fields.See the example below

replicationOption Fields

ParameterTypeRequiredDescriptionExample
migrateSchemaBooleanNoWhether to replicate object schemas. The default value is true.true
migrateDataBooleanNoWhether to replicate existing data. The default value is true.true
incrementalReplicationBooleanNoWhether to replicate incremental data. The default value is false.false
specTypeStringNoReplication instance specification. See Spec Type Values. The default value is micro.micro
conflictStrategyStringYesData or schema conflict handling strategy. See Conflict Strategy Values.ignore
supportDDLBooleanNoWhether DDL replication is supported. The default value is true. For the backward task of bidirectional replication, this value is fixed to false.true

objectConfig Fields

ParameterTypeRequiredDescriptionExample
allBooleanNoWhether to include all objects in the instance. The default value is false. When set to true, databaseList is not required.true
databaseListArrayNoDatabase object list. Required when all=false. See Database or Schema Object Fields.See the example below

Database or Schema Object Fields

databaseList and schemaList use the same object structure. For a source with a database-table hierarchy, a databaseList element represents a database. For a source with a database-schema-table hierarchy, a schemaList element represents a schema.

ParameterTypeRequiredDescriptionExample
allBooleanNoWhether to include all child objects under the current database or schema. The default value is false.false
allTableBooleanNoWhether to include all tables. The default value is false.true
allViewBooleanNoWhether to include all views. The default value is false.false
allTriggerBooleanNoWhether to include all triggers. The default value is false.false
allEventBooleanNoWhether to include all events. The default value is false.false
allFunctionBooleanNoWhether to include all functions. The default value is false.false
allProcedureBooleanNoWhether to include all procedures. The default value is false.false
schemaListArrayNoSchema object list. Use this field for three-level source structures. Elements use the same fields as this table.See the example below
tableListArrayNoSpecific table object list. Elements use Specified Object Fields.See the example below
viewListArrayNoSpecific view object list. Elements use Specified Object Fields.See the example below
functionListArrayNoSpecific function object list. Elements use Specified Object Fields.See the example below
procedureListArrayNoSpecific procedure object list. Elements use Specified Object Fields.See the example below
eventListArrayNoSpecific event object list. Elements use Specified Object Fields.See the example below
triggerListArrayNoSpecific trigger object list. Elements use Specified Object Fields.See the example below
ddlTriggerListArrayNoSpecific DDL trigger object list. Elements use Specified Object Fields.See the example below
otherStoredObjectListArrayNoOther stored object list. Elements use Specified Object Fields.See the example below

Specified Object Fields

ParameterTypeRequiredDescriptionExample
databaseNameStringYesSource database name.db1
targetDatabaseStringNoTarget database name. Defaults to databaseName.db1_target
schemaNameStringNoSource schema name. This field can be configured for three-level source structures. The default value is null.public
targetSchemaStringNoTarget schema name. This field can be configured for three-level target structures. The default value is null.public_target
objectNameStringYesSource object name.table_a
targetNameStringNoTarget object name. Defaults to objectName.table_a_target

Request Example

{
"name": "replication_demo",
"sourceDatasourceType": "mongodb",
"sourceDatasourceId": "ds-source001",
"targetDatasourceType": "mongodb",
"targetDatasourceId": "ds-target001",
"createType": "one_way",
"replicationOption": {
"migrateSchema": true,
"migrateData": true,
"incrementalReplication": false,
"specType": "micro",
"conflictStrategy": "ignore",
"supportDDL": true
},
"objectConfig": {
"all": true
}
}

Response Parameters

ParameterTypeDescriptionExample
successBooleanWhether the request was successful.true
requestIdStringRequest ID.Oc0a0NWF-BHIAdUBnAEFz4OOdCIt7ANB
dataObjectCreation result.See the example below
data.replicationIdStringNewly created replication task ID.rp-div1e4z3z3g3

Successful Invocation Example

{
"success": true,
"requestId": "Oc0a0NWF-BHIAdUBnAEFz4OOdCIt7ANB",
"data": {
"replicationId": "rp-div1e4z3z3g3"
}
}

Create Type Values

ValueDescription
one_wayCreates a one-way replication task.
bidirectionalCreates both forward and backward tasks to form a bidirectional replication task.
bidirectional_from_existingAdds a backward task to an existing task to form a bidirectional replication task.

Spec Type Values

micro, small, medium, large, xlarge.

Conflict Strategy Values

ValueDescription
ignoreIgnores conflicts.
abortStops task execution when a conflict occurs.
replaceDeletes conflicting data and rewrites it. This only applies to full replication.
drop_createDeletes and recreates conflicting table structures. This only applies to schema replication.