Skip to content

Instantly share code, notes, and snippets.

@sreeix
Created August 17, 2011 07:45
Show Gist options
  • Save sreeix/1151052 to your computer and use it in GitHub Desktop.
Save sreeix/1151052 to your computer and use it in GitHub Desktop.
How to run large schema changes
Schema Migrations
* Master for writes Passive master(slave) for reads
* Kill all slave db connections.
* Mark slave readonly.(safety)
* Mark slave offline(for the application)
* Should make the application transparently/otherwise switch reads to master
* Run schema migration on slave. Have some coffee(hours)
* Let Slave Catch up with the master.(some hours)
* Bring the site down
* Kill all master db connections.
*
* Make slave the master.
* Bring the site up.
* Old master replicates from the new master(But still not online)
* Mark new Slave Online
* App now seamlessly/otherwise reads from slave
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment