Configuring MySQL dual backup in the same city can achieve near-real-time data synchronization between two instances, but true real-time synchronization depends on the replication method used.
MySQL supports asynchronous replication by default, where data changes are logged in the binary log (binlog) and sent to the replica instance with some delay. This is not truly real-time but can achieve near-real-time synchronization if the network and server performance are good.
For stricter real-time requirements, semi-synchronous replication can be configured. In this mode, the primary instance waits for at least one replica to acknowledge receipt of the transaction before committing it. This reduces data loss risk but still has minor latency.
Alternatively, Group Replication or MySQL InnoDB Cluster (based on Group Replication) provides multi-primary or single-primary synchronous replication, ensuring strong consistency across instances. However, this introduces higher overhead and may impact performance.
Example:
For high availability and synchronization in Tencent Cloud, you can use TencentDB for MySQL with built-in replication features, including semi-synchronous and asynchronous options, to meet different synchronization needs.