Read Replicas
Distribute read traffic across replica servers to reduce load on the primary. Direct SELECT queries to replicas and write queries (INSERT/UPDATE/DELETE) to the primary.
Distribute read traffic across replica servers to reduce load on the primary. Direct SELECT queries to replicas and write queries (INSERT/UPDATE/DELETE) to the primary.
-- On primary: show replica status
SHOW MASTER STATUS;
-- On replica: check replication lag
SHOW SLAVE STATUS\G
-- Seconds_Behind_Master should be 0 or near 0
-- Application pattern:
-- $writeDb = connectTo('primary');
-- $readDb = connectTo('replica');
Replication lag means replicas may serve stale data — account for this in your app.