Multi-Source Data Replication
NineData Data Replication supports full and incremental synchronization across three or more data sources. Use this workflow to build an active-active topology where changes from one data source are synchronized to the other participating data sources.
Overview
This guide uses bidirectional replication to build a synchronization workflow across three data sources. Changes made in one data source can then be synchronized to the other two data sources.
The example uses data sources A, B, and C. Data source A acts as the central data node. You create bidirectional replication tasks between A and B, and between A and C. This pattern supports real-time synchronization scenarios such as cross-region disaster recovery and geo-distributed active-active deployment.
Use this method only for real-time synchronization across three or more data sources.
Before you begin
- All data sources participating in data replication have been added to NineData. For details, see Add Data Source.
Use one of the supported source and target data source combinations listed below.
| Source Database | Target Database | Schema Repl. | Full Repl. | Incre Repl. |
|---|---|---|---|---|
| MySQL | MySQL | ✔️ | ✔️ | ✔️ |
| Oracle | ✔️ | ✔️ | ✔️ | |
| OceanBase Oracle | ✔️ | ✔️ | ✔️ | |
| OceanBase MySQL | ✔️ | ✔️ | ✔️ | |
| TDSQL MySQL | ✔️ | ✔️ | ✔️ | |
| PolarDB-X | ✔️ | ✔️ | ✔️ | |
| SQL Server | SQL Server | ✔️ | ✔️ | ✔️ |
| Azure SQL Database | ✔️ | ✔️ | ✔️ | |
| PostgreSQL | PostgreSQL | ✔️ | ✔️ | ✔️ |
| Oracle | MySQL | ✔️ | ✔️ | ✔️ |
| PolarDB-X | ✔️ | ✔️ | ✔️ | |
| OceanBase Oracle | OceanBase Oracle | ✔️ | ✔️ | ✔️ |
| OceanBase MySQL | OceanBase MySQL | ✔️ | ✔️ | ✔️ |
| PolarDB-X | ✔️ | ✔️ | ✔️ | |
| TDSQL MySQL | OceanBase MySQL | ✔️ | ✔️ | ✔️ |
| PolarDB-X | ✔️ | ✔️ | ✔️ | |
| Redis | Redis | - | ✔️ | ✔️ |
| TiDB | PolarDB-X | ✔️ | ✔️ | ✔️ |
| Sybase | PostgreSQL | - | ✔️ | ✔️ |
| PolarDB-X | PolarDB-X | ✔️ | ✔️ | ✔️ |
| Azure SQL Database | SQL Server | ✔️ | ✔️ | ✔️ |
| Azure SQL Database | ✔️ | ✔️ | ✔️ |
If the task does not include schema replication, the target data source must already contain the same schema definitions as the source replication objects. For example, to replicate incremental data of
Table_Afrom data source A to data source B, data source B must already containTable_Awith the same schema asTable_Ain data source A.For each MySQL data source in the replication topology, enable Binlog and set the following Binlog parameters:
binlog_format=ROWbinlog_row_image=FULLtipIf the source data source is a standby database, enable
log_slave_updatesso NineData can obtain the complete Binlog.
Restrictions
- Data replication applies only to user databases in the data source. System databases are not replicated. For example, MySQL system databases such as
information_schema,mysql,performance_schema, andsysare not replicated. - The source account must have
SELECTprivileges for schema and full data replication,SHOW VIEWprivileges for view replication, andREPLICATION CLIENTandREPLICATION SLAVEprivileges for incremental replication. The target account must have DML and DDL privileges. - Before starting data synchronization, evaluate the performance of the source and target data sources. Run synchronization during off-peak hours when possible. Otherwise, full data initialization consumes read and write resources on both data sources and increases database load.
- If the source data source contains views, functions, stored procedures, triggers, or events, the definer information of these objects is changed on the target data source to the account used by the current synchronization task to access the target data source.
- Make sure every table in the synchronization objects has a primary key or unique constraint, and that column names are unique. Otherwise, duplicate rows may be synchronized.
- If triggers exist in the source data source, NineData synchronizes the triggers only after incremental synchronization ends.
Procedure
Step 1: Add a multi-active tag to each data source
To prevent circular replication, add a multi-active tag to every data source that participates in the replication tasks.
Sign in to the NineData Console.
Go to Datasource > Datasource.
Click the target data source ID to open the Details page.
In the data source details area (that is, the area containing information such as the data source name, ID, creator, and creation time), click Show Details.
Find Multi-Active Tag, then click the
icon on the right.
Enter the multi-active tag, and click OK.
tip- A multi-active tag can contain 1 to 64 characters.
- The multi-active tag must be globally unique and cannot duplicate another multi-active tag.
Step 2: Create a bidirectional replication task between data source A and data source B
Sign in to the NineData Console.
Go to Replication > Data Replication.
On the Replication page, click Create Replication.
On the Source & Target tab, configure the task, and then click Next.
Parameter Description Task Name Enter a meaningful data synchronization task name for later search and management. Up to 64 characters are supported. Source data source Select data source A as the central data node. Data source A sends its DDL and DML changes to the other data sources and consolidates DML changes from all other nodes. Target data source Select data source B, which will run bidirectional data replication with data source A. Replication Mode Select Bi-directional. Forward Type Select the replication type from data source A to data source B. In this example, keep the default selections: Schema, Full, and Incremental. Click to clear operation types that you do not want to replicate during incremental synchronization. In bidirectional replication, Incremental is always selected and cannot be cleared.
Forward Incremental Start Time Required only when Incremental is selected. - From Started: Start incremental replication from the start time of the current replication task.
- Customized Time: Select the time point and time zone for incremental replication. If the selected time point is earlier than the start time of the current replication task and a DDL operation occurs during that period, the task fails.
Reverse Type For replication from data source B to data source A, only Incremental is supported. It is selected by default and cannot be cleared. Support DDL Replication Controls whether NineData replicates DDL operations during incremental replication. - Forward replication supported, reverse not supported: NineData replicates incremental DDL operations from data source A to data source B. Do not run DDL operations in data source B for this task. Otherwise, the task may fail.
- NOT Supported: NineData does not replicate incremental DDL operations. Do not run DDL operations in data source A or B for this task. Otherwise, the task may fail.
Target table preparation configuration - If target table already exists (required when Schema is selected)
- Pre-Check Error and Stop Task: Stop the task if the precheck detects a table with the same name.
- Skip and Continue Task: If the precheck detects a table with the same name, continue the task after a message appears. During schema replication, NineData skips that table. If data replication is also enabled, NineData appends data to the existing table without overwriting the original data.
- Delete Objects and Rewrite: If the precheck detects a table with the same name, continue the task after a message appears. During schema replication, NineData deletes the table with the same name in the target database and copies the table schema from the source database again. If data replication is also enabled, NineData writes data after the schema is copied.
- Keep Schema and Clear Data, then Rewrite (available when schema and data are replicated together): If the precheck detects a table with the same name, continue the task after a message appears. During schema replication, NineData keeps the target table schema. When data replication starts, NineData clears the data in the table with the same name and then copies data from the source table again.
- Target Table Exists Data (required when Schema is not selected)
- Pre-Check Error and Stop Task: Stop the task if the precheck detects existing data in the target table.
- Ignore existing target data and append to it.: If the precheck detects existing data in the target table, ignore that data and append new data.
- Clear target existing data before write: If the precheck detects existing data in the target table, delete the existing data before writing new data.
On the Objects tab, configure the replication objects, and then click Next.
Parameter Description Replication Objects Select the objects to replicate. Select All Objects to replicate all objects in the source database, or select Customized Object, choose the objects in the Source list, and click > to move them to the Target list. Blocklist (optional) Click Add to add a blocklist rule. Select the databases or objects to exclude from replication. Blocklists are used to exclude specific databases or objects when All Objects or Customized Object replication is selected. - Left drop-down list: Select the database to add to the blocklist.
- Right drop-down list: Select one or more objects in the selected database. Leave this field empty to add the entire database to the blocklist.
On the Mapping tab, choose the action that matches the selected replication Type.
- Includes Schema: Configure the target table name after the table is synchronized to the target data source, and then click Save and Pre-Check.
tipClick Mapping & Filtering to customize target column names after synchronization. Set Data Filter by using comparison expressions. Only data that matches the filter conditions is synchronized to the target data source.
- Does not include Schema: NineData selects the database with the same name in the target data source by default. If no database with the same name exists, select the target database manually. The table and column names in the target database must match the replication objects. If they do not match, map the table and column names manually.
On the Pre-check tab, wait for NineData to finish the precheck. After the precheck passes, click Launch.
tipSelect Enable data consistency comparison to compare the target data with the source data after the synchronization task completes. The comparison start time depends on the replication Type:
- Schema: Starts after schema replication completes.
- Schema + Full: Starts after full replication completes.
- Schema + Full + Incremental (SQL Server is not currently supported): Starts when the incremental data is consistent with the source data for the first time and the Delay is 0 seconds. Click View Details to view the synchronization delay on the Details page.

If the precheck fails, click Details in the Actions column for the failed item to view the cause. After fixing the issue, click Check Again to run the precheck again.
For warnings, fix the issue or ignore the warning when appropriate.
On the Launch page, after Launch Successfully appears, the replication task starts. Use these actions to review the task:
- Click View Details to view the execution status of each synchronization phase.
- Click Back to list to return to the Replication list.
Step 3: Create a bidirectional replication task between data source A and data source C
Repeat Step 2, but select data source C as the Target.
Result
After the three-node replication workflow is deployed, data changes on any participating data source are synchronized to the other data sources in real time. Add more supported data sources by repeating Step 2. This guide does not define a fixed node limit, so consider network bandwidth and hardware resources during architecture design.
Sign in to the NineData Console.
In the navigation menu, select Replication > Data Replication.
On the Replication page, click the Task ID of the target synchronization task. The task details page shows the following information.

Number Function Description 1 Sync Delay The synchronization delay between the source and target data sources. 0seconds means the target has caught up with the source. Switch traffic based on your migration plan.2 Configure Alerts When the task fails, NineData notifies the selected channel through the configured alert. 3 More - Pause: Pause the task. Only tasks with Running status are selectable.
- Duplicate: Create a new replication task with the same configuration as the current task.
- Terminate: Terminate tasks that are incomplete or still listening (that is, in incremental synchronization). After a task is terminated, it cannot be restarted, so proceed with caution. If the synchronization objects contain triggers, trigger replication options appear for selection.
- Delete: Delete the task. Once deleted, it cannot be recovered, so proceed with caution.
4 Structure Replication (displayed in scenarios involving structure replication) Displays the progress and detailed information of structure replication. - Select Log to view the execution logs of structure replication.
- Select the
to view the latest information.
- Select View DDL in the Actions column for the target object in the list to view SQL replay.
5 Full Replication (displayed in scenarios involving full replication) Displays the progress and detailed information of full replication. - Select Monitor to view various monitoring indicators during full replication. During full replication, select Flow Control Settings on the monitoring page to limit the rate of writing to the target data source per second. The unit is rows/second.
- Select Log to view the execution logs of full replication.
- Select the
to view the latest information.
6 Incremental Replication (displayed in scenarios involving incremental replication) Displays incremental replication indicators. - Select View Threads to view the operations currently being executed by the current replication task, including:
- Thread ID: Replication tasks are executed in multiple threads, and this shows the current thread number.
- Execute SQL: Details of the SQL statement currently being executed by the current thread.
- Response Time: The response time of the current thread. If this value increases, it indicates that the current thread may be stuck for some reason.
- Event Time: The timestamp when the current thread was started.
- Status: The status of the current thread.
- Select Flow Control Settings to limit the rate of writing to the target data source per second. The unit is rows/second.
- Select Log to view the execution logs of incremental replication.
- Select the
to view the latest information.
7 Modify Object Displays the modification records of synchronization objects. - Select Modify Objects to configure the synchronization objects.
- Select the
to view the latest information.
8 Data Comparison Displays the comparison results between the source and target data sources. If data comparison is not enabled, select Enable Comparison on the page to enable it. - Select Re-compare to rerun the comparison for the current source and target data sources.
- Select Stop to stop the comparison task immediately after it starts.
- Select Log to view the execution logs of consistency comparison.
- Select Monitor (displayed only in data comparison) to view the trend chart of RPS (records per second) comparison. Select Details to view earlier records.
- Select the
in the Actions column in the comparison list (displayed under the Data tab only when inconsistencies are found) to view details of the comparison between the source and target data sources.
- Select the
in the Actions column in the comparison list (displayed only when inconsistencies are found): Generate change SQL. Copy this SQL to the target data source and run it to fix the mismatch.
9 Expand Displays detailed information of the current replication task. Common actions: - Export table configuration: Export the current task's database and table configuration for quick import when creating another replication task with the same objects.
- Alert Rules: Configure alerts for the current task.