Semi-Sync Replication
Standard replication is asynchronous — primary commits before replica confirms. Semi-sync waits for at least one replica to acknowledge before committing.
Standard replication is asynchronous — primary commits before replica confirms. Semi-sync waits for at least one replica to acknowledge before committing.
-- Install semi-sync plugins
INSTALL PLUGIN rpl_semi_sync_source SONAME "semisync_source.so";
INSTALL PLUGIN rpl_semi_sync_replica SONAME "semisync_replica.so";
-- Enable on primary:
SET GLOBAL rpl_semi_sync_source_enabled = 1;
SET GLOBAL rpl_semi_sync_source_timeout = 1000; -- 1s timeout, fallback to async
-- Enable on replica:
SET GLOBAL rpl_semi_sync_replica_enabled = 1;
-- Monitor:
SHOW STATUS LIKE "Rpl_semi_sync%";
Semi-sync reduces data loss on primary failure at the cost of slightly higher write latency.