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

  • Doing Hos is Hard Work

    Etch-a-Sketch doesn't involve much hill climbing. GPS-a-Sketch in San Francisco does, however: Merry Christmas from me and…

  • Adventurous Weekend

    Before I fall asleep, I'll try to recap the awesomeness that was this weekend. Friday: -- kinda short day at work, due to floor…

  • Bike Route

    A fellow biker last Friday recorded our ride to work: our ride.

  • 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.