Replication
On this page
The replication process forms an essential part of a disaster recovery (DR) plan.
SingleStore replicates data in the following situations.
-
When you run your cluster in high availability, redundancy-2 mode, SingleStore replicates data from master to replica partitions in the same cluster.
-
When you use the REPLICATE DATABASE command, SingleStore replicates data across clusters.
Synchronous Replication Debugging Flow
The diagram below shows what happens when an async alert is raised at the partition level.
High availability, Redundancy-2 mode
With high availability redundancy-2 replication, you can specify, using the CREATE DATABASE, RESTORE DATABASE and ALTER DATABASE commands, whether replication from primary to replica partitions is synchronous or asynchronous.
Synchronous replication is usually no more than ten to twenty percent slower than asynchronous replication.
If a database is using synchronous replication and its replica partition fails to respond within five seconds, the replica partition switches to asynchronous replication; this allows the replica partition to not block the current and future replication transactions.
-
The replica partition becomes responsive.
-
The primary partition becomes responsive, if it was previously unresponsive.
When the replica partition resumes failover, it switches to synchronous replication.
Replica Log Replay and Partition Promotion during HA Failover.
-
Replica log pages are received/hardened on one path; applying them into memory (replay) runs asynchronously and can lag.
-
Before a replica partition becomes master, the engine waits until replay has applied all locally committed log (online failover also syncs promote targets first).
-
While a partition is in promote-to-master transition, new reads and writes to that partition are blocked until promotion completes (or fails/times out).
Writes against a steady-state replica partition fail; reads may see stale data. -
This process is separate from sync vs async replication (whether the master waits for replica ack before acknowledging commit to the client).
-
The
master_andpromote_ timeout master_timeout variables for bounded waits during online failover.promote_ kill_ timeout_ seconds
REPLICATE DATABASE
When you use the REPLICATE DATABASE command, you can only replicate asynchronously.
Last modified: