Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Moving Lanyrd: Changing database and datacentre

Moving Lanyrd: Changing database and datacentre

A short talk I gave as part of the Eventbrite "Advanced Django" workshop at PyCon 2014

Andrew Godwin

April 10, 2014
Tweet

More Decks by Andrew Godwin

Other Decks in Programming

Transcript

  1. MySQL PROBLEM ONE Adding columns is slow Data integrity is

    poor Limited set of data types This is a whole talk by itself.
  2. THE SPECTRUM OF HOSTING Per-hour costs Least customisable Per-decade costs

    Most customisable "Cloud" providers Own Datacentre Colocation Dedicated servers VPS providers
  3. Both need time in read-only mode Both involve copying whole

    dataset Time usage is interleaved nicely
  4. MySQL 1st SQL file "Postgres compatible" dump 2nd SQL file

    Scripted file conversion PostgreSQL 1st schema load over network
  5. MySQL 1st SQL file "Postgres compatible" dump 2nd SQL file

    Scripted file conversion PostgreSQL 1st schema PostgreSQL 2nd schema Schema alteration / type casts load over network
  6. THE DAY BEFORE Make sure new servers are ready Set

    DNS TTL to 300s GO! (9am GMT) Put site in read-only mode Start database dump & conversion
  7. THE DAY BEFORE Make sure new servers are ready Set

    DNS TTL to 300s GO! (9am GMT) Put site in read-only mode Start database dump & conversion CONVERSION FINISHED (9:30am GMT) Start load and cast of data into new DB
  8. THE DAY BEFORE Make sure new servers are ready Set

    DNS TTL to 300s GO! (9am GMT) Put site in read-only mode Start database dump & conversion CONVERSION FINISHED (9:30am GMT) Start load and cast of data into new DB LOAD FINISHED (10:15am GMT) Verify site is working correctly
  9. THE DAY BEFORE Make sure new servers are ready Set

    DNS TTL to 300s GO! (9am GMT) Put site in read-only mode Start database dump & conversion CONVERSION FINISHED (9:30am GMT) Start load and cast of data into new DB LOAD FINISHED (10:15am GMT) Verify site is working correctly VERIFIED (10:30am GMT) Switch DNS Point old loadbalancers to new servers Exit read-only mode