How to Achieve Bidirectional Synchronization Between TiDB and MySQL

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb和mysql 如何做到双向同步

| username: swino

How to achieve bidirectional synchronization between TiDB and MySQL

| username: 小龙虾爱大龙虾 | Original post link

Forward MySQL to TiDB: DM tool
Reverse TiDB to MySQL: TiCDC tool
Bidirectional synchronization is generally not recommended, as it requires addressing data looping issues. For data migration, one-way synchronization is usually sufficient.

| username: Miracle | Original post link

Can you tell me what this scenario is?

| username: 啦啦啦啦啦 | Original post link

Currently, it should not be possible, but TiDB can perform bidirectional synchronization.

| username: 像风一样的男子 | Original post link

Big pit, I suggest not doing it.

| username: Soysauce520 | Original post link

If there is an inconsistency caused by unexpected situations during the bidirectional synchronization between dm-MySQL to TiDB and ticdc, binlog-TiDB to MySQL, which side should be considered as the standard?

| username: Fly-bird | Original post link

MySQL can be synchronized to TiDB. TiDB generates SQL and then writes a script to synchronize it. This way, there is a delay, but it should be achievable indirectly.

| username: 路在何chu | Original post link

In this case, it would be better to implement a cascading synchronization.

| username: andone | Original post link

There should be a lot of pitfalls in doing this.

| username: TiDBer_KugsyWcF | Original post link

The main thing to consider during migration is the fallback plan. In case the switch to TiDB fails, can we switch back to MySQL?

| username: TIDB-Learner | Original post link

What you refer to as bidirectional synchronization, I understand as data being written to both sides. The differing data needs to be written to the other side to ensure consistency. This inevitably involves resolving write conflicts. TiDB supports bidirectional replication starting from version 6.5, enabling multi-write and multi-active TiDB clusters. How does the combination of DM and TiCDC mentioned above solve this issue?

For example, issues like duplicate auto-increment primary keys and write conflicts. If one end is read-only externally, any incremental synchronization tool can achieve this. However, in the multi-write and multi-active scenario mentioned above, non-stacking tools can perfectly solve the problem.

| username: 小龙虾爱大龙虾 | Original post link

There’s no need for bidirectional synchronization; unidirectional synchronization at the same time is sufficient.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.