MySQL – How to Migrate Huge Databases One by One to New Server

migrationMySQL

We have several servers with huge databases (on average 100-200GB per DB up to ~500GB for the biggest ones). All of them have a slave that is used for backups.

Now I need to migrate those with minimal or no downtime and preferably one DB at a time. First thing that came to my mind is doing a backup including master-data and setup replication. With the size of these databases dumping and reimporting takes quite a while, so I was looking into using innobackupex. That works and I can filter for one DB. However I still get all directories for all databases (even though they're empty) and an ibdata1 file of close to 2GB.

My main concern is, that this will only work for the first database. I can't do that for a second one and add that to a running slave as this would conflict with already existing data. Am I missing something or is it only possible to setup a slave for ALL databases of an existing MySQL server at once?

The servers are a mix of MySQL 5.1 and 5.5 and the new hosts should start with 5.7. Does the multi-source replication feature help with my approach?

Best Answer

I think I found a solution which is close to what I'm trying to achieve: https://dba.stackexchange.com/a/76198/107793.

The only thing I have to look into is, how to avoid the possible downtime with locking the tables. Since I'm on InnoDB exclusively (apart from the MySQL system DBs) that should be possible.