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

077e9a0cb34fa3eba2699240c9509717?s=128

Andrew Godwin

April 10, 2014
Tweet

Transcript

  1. 4.
  2. 9.

    MySQL PROBLEM ONE Adding columns is slow Data integrity is

    poor Limited set of data types This is a whole talk by itself.
  3. 12.

    THE SPECTRUM OF HOSTING Per-hour costs Least customisable Per-decade costs

    Most customisable "Cloud" providers Own Datacentre Colocation Dedicated servers VPS providers
  4. 14.

    Both need time in read-only mode Both involve copying whole

    dataset Time usage is interleaved nicely
  5. 16.
  6. 19.

    MySQL 1st SQL file "Postgres compatible" dump 2nd SQL file

    Scripted file conversion PostgreSQL 1st schema load over network
  7. 20.

    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
  8. 24.

    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
  9. 25.

    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
  10. 26.

    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
  11. 27.

    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