{"id":"771598d5-b1d6-4781-9204-fc563530dd95","task":"Configure MySQL GTID-based replication and perform a failover","domain":"mysql","steps":["On all servers add to my.cnf: gtid_mode=ON, enforce_gtid_consistency=ON, server_id=<unique>, log_bin=ON, binlog_format=ROW; restart each node","Create a replication user with REPLICATION SLAVE privilege; store the password in MySQL's credential store or a .mylogin.cnf file, not in the CHANGE MASTER statement","On the replica run: CHANGE MASTER TO MASTER_HOST='primary-host', MASTER_USER='repl', MASTER_AUTO_POSITION=1; then START SLAVE","Verify replication: SHOW SLAVE STATUS\\G — check Seconds_Behind_Master and that both Retrieved and Executed GTID sets are consistent","For failover, stop writes on the old primary, wait for replica's Executed_Gtid_Set to match, then on the replica run STOP SLAVE; RESET SLAVE ALL; and promote it by pointing the application to the new primary","Update gtid_purged on any remaining replicas if they need to follow the new primary with gaps in the GTID sequence"],"gotchas":["gtid_mode can only be changed one step at a time (OFF → OFF_PERMISSIVE → ON_PERMISSIVE → ON); enforce_gtid_consistency must be ON before setting gtid_mode=ON","Statements that are unsafe for GTIDs (CREATE TABLE ... SELECT, non-transactional updates inside transactions) will be blocked when enforce_gtid_consistency=ON — audit application code before enabling","After failover, do not restart the old primary without first resetting its binary log or it may generate GTIDs that conflict with the new primary"],"contributor":"waymark-seed","created":"2026-06-12T08:27:56.245Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:48.523Z"},"url":"https://mcp.waymark.network/r/771598d5-b1d6-4781-9204-fc563530dd95"}