Currently have a MySQL replication setup in which Master A is replicated on another server db Slave B.

I'm shutting down the server that hosts Master A and need to start a new server that houses Master C that will be the replacement for Master A and maintaining all the data.

Slave B will then need to replicate from Master C. Master A will then be deleted.

How do I make this change with minimal or no downtime?

link|improve this question

65% accept rate
Is it possible to make Slave B into the new master? – Chris Ting Oct 22 '11 at 10:38
Nope. Slave B is on a different server that is tuned differently. – lamp_scaler Oct 22 '11 at 10:56
How large is your database? Do you have any idea how long it would take to make a mysqldump? – Chris Ting Oct 22 '11 at 11:05
Not too long. But I'll need to SCP it over to the new master server and the load it. And then set up the slave again. All this takes time and I would like to reduce downtime as much as possible. Awhile ago I was able to migrate and setup new slaves without downtime. But migrating a Master seems more of a challenge. – lamp_scaler Oct 22 '11 at 11:20
feedback

1 Answer

From your comments, here's a way to minimize downtime with your setup.

Step 1: Set up the new master server as a slave to your old master.

Step 2: Allow Slave C to catch up to Master A, and then take down mysql on Master A.

Step 3: Ensure you have all Master A's data, then turn Slave C into Master C.

Step 4: Point Slave B at Master C.

You'll lose Slave B for a little while as you'll need to sync it with Master C, but at least you'll always have one live instance except for the few minutes you take to ensure all data on Master A made it to Master C.

link|improve this answer
Adding on this: To setup the new slave C in step 1, shutdown slave B and clone that to slave C. If LVM is available, shutdown slave B, take snapshot, start slave B, mount snapshot and clone slave C from there. Keep server-id in mysql.ini unique. Watch out to edit replication information accordingly (uses hostname!). – korkman Oct 23 '11 at 14:34
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.