Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm setting up 2 new database servers that will be replacing a current master-slave setup. All boxes are running / will be running MySQL on RHEL.

Our current naming conventions:

db1 - master database

db2 - slave (using MySQL replication)

db01 - new master

db02 - new slave

We need to get db01 to be the new master with db02 as the new slave. What is the best way to migrate db1 and db2 to db01 and db02?

db1 and db2 are running in a production setting and we need to minimize all downtime; db1 has roughly 30GB of data in the database.

Any suggestions or tips on how to migrate to our new servers would be much appreciated.

share|improve this question

1 Answer 1

Having replication in place make it quite straight forward. This is because it is easy to turn a master into a slave and vice versa.

1) Setup (new) db01 as a slave of (old) db1.

2) You could then use the daisy chain feature to make (new) db02 the slave of (new) db01. [At this point you will have a string of three servers].

3) Redirect live traffic to db01 and db02.

4) Once certain db0X are handling live traffic switch off dbX.

share|improve this answer
    
Would setting up db01 as a slave to db1 require us to lock db1? If so, anyway around that? –  mmattax May 4 '10 at 13:50
    
You need to be sure the data you have matches the master log position exactly. So normally you lock the database during the dump and use --maste-data to get the locations. However you can use the --single-transaction flag in mysqldump to setup a transation log, which will avoid the locking problem. –  Coops May 4 '10 at 14:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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