Saturday, April 21, 2012

MySQL: Master – Master setup -- Do big schema changes with no downtime

Master – Master setup
• Setup two replicas of your database copying changes to each-other
• Keep it simple! (all writes to one master)
• Instant fail-over host – no slave changes needed
• Configuration is easy!
• set-variable = auto_increment_increment=2 set-variable = auto_increment_offset=1
• (offset = 2 on second master)
• Setup both systems as a slave of the other


Online Schema Changes
The reasons we love master-master!
• Do big schema changes with no downtime!
• Stop A to B replication
• Move traffic to B
• Do changes on A
• Wait for A to catchup on replication
• Move traffic to A
• Re-start A to B replication

No comments:

Post a Comment