Bidirectional Replication between Redis Data Sources
NineData Data Replication supports real-time bidirectional synchronization between two or more Redis data sources.
Overview
Bidirectional Redis replication creates a continuous synchronization channel between Redis instances. Each instance can receive read and write traffic while NineData maintains eventual consistency and controls replication conflicts.
Before you begin
- Both the source and target data sources must be Redis. Use the same Redis version on all participating data sources when possible.
- Supported Redis architectures include standalone, primary-replica, read/write separation, and cluster deployments.
Step 1: Add an active-active marker to every data source
Use an active-active marker on every data source in the task to prevent replication loops.
Sign in to the NineData Console.
In the left navigation bar, click Data Sources > Data Sources.
Click the target data source ID to open its details page.
In the data source details area, click More.
Find Active-Active Marker and click the edit icon.
Enter a marker and click OK.
tip- The marker can contain 1–64 characters.
- The marker must be globally unique.
Step 2: Configure the bidirectional replication task
Sign in to the NineData Console.
In the left navigation pane, click Replication > Data Replication.
On the Replication page, click Create Replication.
On the Source & Target tab, configure the fields in the table, and click Next.
Parameter Description Name Enter a name for the data synchronization task. To make the task easier to find and manage later, use a meaningful name. Up to 64 characters are supported. Source The data source that contains the objects to synchronize. Datahub Project Select the target Datahub Project. Data from the source data source will be written to the specified Project. Target Object Name Select the case conversion rule for object names after they are migrated from the source to the target. - Convert all to Lowercase: Regardless of the naming rule on the source, all target names are lowercase.
- Consistent with Source: Keep the naming rule of the source.
- Convert all to Uppercase: Regardless of the naming rule on the source, all target names are uppercase.
Replication Mode Select the replication mode.Select Bi-directional here. - Uni-directional: A unidirectional data replication task from the source data source to the target data source.
- Bi-directional: A bidirectional incremental data replication task between the source and target data sources.
Forward Type Required when Replication Mode is Bi-directional. Select the forward replication type. - Full: Synchronize all objects and data from the source data source, namely full data replication.
- Incremental: After full synchronization completes, perform incremental synchronization based on the logs of the source data source.
Incremental Started Required only when Type is Incremental. - From Started: Use the current replication task start time as the baseline for incremental replication.
- Customized Time: Select the point in time from which incremental replication starts. Select a time zone based on the region of your business. If the configured time point is earlier than the current replication task start time and DDL operations occurred during that period, the replication task will fail.
Forward Incremental Started Required only when Forward Type is Incremental. - From Started: Use the current replication task start time as the baseline for incremental replication.
- Customized Time: Select the point in time from which incremental replication starts. Select a time zone based on the region of your business. If the configured time point is earlier than the current replication task start time and DDL operations occurred during that period, the replication task will fail.
Reverse Type The replication type from the target data source to the source data source. This parameter is displayed only when Replication Mode is Bi-directional. Only Incremental is supported, and it is selected by default and cannot be disabled. Target Table Exists Data (Required when Full is selected) - Pre-Check Error and Stop Task: Stop the task when data is detected in the target table during the precheck stage.
- Ignore existing target data and append to it.: When data is detected in the target table during the precheck stage, ignore that data and append other data.
- Clear target existing data before write: When data is detected in the target table during the precheck stage, delete that data and write it again.
Incremental data conflict handling strategy for target table (Required when Incremental is selected) - Runtime error: During incremental replication, report an error when target data already exists and wait for manual intervention.
- Do not update target data: During incremental replication, do not write data when target data already exists, and continue subsequent tasks.
- Update target data: During incremental replication, overwrite the target data when target data already exists.
On the Objects tab, configure the parameters in the table, and click Next.
Parameter Description To create multiple replication tasks with the same replication objects, import a configuration file. Click Import Config, click Download Template to download the template, edit the file, and then click Upload to upload it and import the objects in bulk. The configuration file uses these fields:
Parameter Description source_database_nameThe source database name of the object to synchronize. target_database_nameThe target database name that receives the synchronized object.
On the Mapping tab, configure the database name after the source database is synchronized to the target data source, and click Save and Pre-Check. If source or target metadata changes while you configure mappings, click Refresh Metadata to refresh the metadata. Other available actions:
- Click Add filter conditions to configure filtering conditions. Only data that meets the filtering conditions is synchronized to the target data source. For examples of filtering condition syntax, see the page.
- Click Batch Configuration to define filtering conditions in batches.
On the Pre-check tab, wait for NineData to complete the precheck. After the precheck passes, click Launch.
Select Enable data consistency comparison to start a data consistency comparison task based on the source data source after synchronization completes. Based on the selected Type, Enable data consistency comparison starts at these times:
- Full: Starts after full replication completes.
- Full+Incremental, Incremental: Starts when incremental data is consistent with the source data source for the first time and Delay is 0 seconds. Click View Details to view synchronization delay on the Details page.

If the precheck fails, click Details in the Actions column for the failed check item, review the cause, fix the issue, and then click Check Again to run the precheck again until it passes.
Items with Warning in Result can be fixed or ignored if required.
On the Launch page, the Launch Successfully message appears, indicating that the synchronization task has started. Then perform these actions:
- Click View Details to view the execution status of each stage of the synchronization task.
- Click Back to list to return to the Replication task list page.
Step 3: View bidirectional replication results
After you create the bidirectional task, NineData automatically creates a reverse replication task that replicates incremental changes from the target back to the source.
Appendix: Supported incremental Redis commands
Only Redis data-change commands supported by NineData are replicated in real time.
| Data type | Supported commands |
|---|---|
| Strings | APPEND, DECR, DECRBY, GETDEL (Redis 6.2+), GETEX (Redis 6.2+), GETSET, INCR, INCRBY, INCRBYFLOAT, MSET, MSETNX, PSETEX, SET, SETEX, SETNX, SETRANGE |
| Lists | BLMOVE, BLMPOP, BLPOP, BRPOP, BRPOPLPUSH, LINSERT, LMOVE, LMPOP, LPOP, LPUSH, LPUSHX, LREM, LSET, RPOP, RPOPLPUSH, RPUSH, RPUSHX |
| Sets | SADD, SDIFFSTORE, SINTERSTORE, SMOVE, SPOP, SREM, SUNIONSTORE |
| Hashes | HDEL, HINCRBY, HINCRBYFLOAT, HMSET, HSET, HSETNX |
| Sorted sets | BZMPOP, BZPOPMAX, BZPOPMIN, ZADD, ZDIFFSTORE, ZINCRBY, ZINTERSTORE, ZMPOP, ZPOPMAX, ZPOPMIN, ZRANGESTORE, ZREM, ZREMRANGEBYLEX, ZREMRANGEBYSCORE, ZUNIONSTORE |
| Streams | XADD, XTRIM, XGROUP, XAUTOCLAIM, XDEL, XREADGROUP |
| Geospatial | GEOADD, GEOSEARCHSTORE |
| HyperLogLog | PFADD |
| Bitmaps | SETBIT, BITFIELD, BITOP |
Appendix: Pre-check items
| Check item | What NineData checks |
|---|---|
| Source and target connection | Gateway status, instance reachability, username, and password |
| Source permissions | Whether the source account meets the requirements |
| Source object existence | Whether target objects also exist on the source |
| Active-active marker | Whether the markers are configured |
| Target data existence | Whether target objects already contain data |
| Circular replication | Whether a replication loop exists |
| Redis log buffer | Whether repl-backlog-size is configured correctly |
| Client output buffer | Whether client-output-buffer-limit replica is configured correctly |