MySQL replication: Best practices and considerations

This post details best practices for MySQL replication, emphasizing active/passive configurations over active/active due to conflict resolution challenges. It strongly advocates for the use of Global Transaction Identifiers (GTIDs) for robust transaction tracking and discusses the benefits and trade-offs of asynchronous versus semi-synchronous replication, noting PlanetScale's use of semi-sync within regions and high timeouts for consistency. The post also covers optimizing log storage by separating binary logs from database disks, the importance of monitoring replication lag, and outlines a step-by-step strategy for unplanned failovers. Finally, it addresses considerations for cross-datacenter replication, recommending asynchronous mode due to increased latency and highlighting the importance of understanding network latency between regions.