Brad Fitzpatrick (brad) wrote,
Brad Fitzpatrick

grossest mysql hack ever

Gross hack to "re-master" or "re-parent" MySQL hosts before 4.1.1
which has the wonderful "SLAVE START UNTIL" command. (the UNTIL part is new)

Basically, if you have B and C both replicating from A, how do you make C
replicate from B instead of A?


-- can't touch A.
-- can't copy files from A or B to C, since C is a different file format
(InnoDB instead of MyISAM)


Keep watching the replication position of B and C until they're the same.
Then stop the replication thread in both, verify they're still the same,
then make C feed off B instead. (this requires that B is already setup
to log-master-updates and log-bin)

Go ugly hacks!

(There's a lot of LJ-specific code in here, but you should figure out
what it does and how to write a non-LJ equivalent. Like, DBI->connect
instead of the LJ-low-level $LJ::DBIRole->get_dbh_conn)
Tags: mysql, perl, tech

  • Happy Birthday!

    Happy 20th Birthday, LiveJournal! 🐐🎂🎉

  • hi

    Posting from the iPhone app. Maybe I'm unblocked now.

  • Why, hello...

    Long time no see. How's my baby doing?

  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.