Mysql – Migrating MySQL to new server

migrationMySQLmysql-5.1mysql-5.5windows

We have a MySQL 5.1 instance running on Windows Server 2008 R2 x64 (Server A) replicated to another MySQL 5.1 instance on Windows Server 2003 R2 (Server B).

We have a new MySQL 5.5 instance on another Windows Server 2008 R2 x64 machine (Server C).

I want to replace Server A with Server C.

My plan is to set up Server C as another slave to Server A by 'cloning' Server B like this:

http://www.redips.net/mysql/add-new-slave/.

After that I plan on doing this:

http://blesseddlo.wordpress.com/2011/06/03/convert-mysql-slave-to-master/.

After that I want to change Server B's master to Server C.

Is this a viable approach? Are there caveats? May there be any compatibility issues when setting a MySQL 5.5 instance as slave to a MySQL 5.1 instance?

I can't just stop everything and use mysqldump since there can be no downtime and we have ~25 GB of data that must be transferred over a Gigabit LAN.

Best Answer

8 months later, but here's the answer:

No problem in having a MySQL 5.5 slave to a 5.1 master. There is a problem with having it the other way around -- I've seen it fail.

Your approach is very viable and is being done frequently. You have both B and C replication from A. Then, at some stage you:

  1. freeze A (via FLUSH TABLES WITH READ LOCK)
  2. Verify both slaves are caught up with A's last statement.
  3. Take A down
  4. Change C to replicate from B, using B's SHOW MASTER STATUS
  5. Tell your application B is the new master
  6. Celebrate with beer

This does require a minimal downtime of a few seconds (and up to a minute) -- it mostly depends on your skills and confidence.