views:

51

answers:

4

This is a methodology question from a freelancer, with a corollary on MySQL.. Is there a way to migrate from an old dedicated server to a new one without losing any data in-between - and with no downtime? In the past, I've had to lose MySQL data between the time when the new server goes up (i.e., all files transferred, system up and ready), and when I take the old server down (data still transferred to old until new one takes over). There is also a short period where both are down for DNS, etc., to refresh.

Is there a way for MySQL/root to easily transfer all data that was updated/inserted between a certain time frame?

A: 

Check out the MySQL binary log.

Emil Vikström
A: 

I'd make a sorry page, put it up on the old server, transfer all data to the new one and then switch DNS. Though there will be a downtime.

Col. Shrapnel
Is there a way to put up a "global sorry page" - lots of mysql processes initiated from many different php/other scripts in multiple directories on multiple domains on server...
ina
I'd make a simple mod_rewrite rule to redirect all requests to the sorry page for the all domains
Col. Shrapnel
A: 

Sure. Enable bin logging on the source server. After that is started, make a DB dump and transfer it to the new server and import it. Then, when you're ready to make the switch, change DNS (let the change propagate while you're working), then take the site down on both servers. Copy the binlogs to the new server and run them again starting at the date/time of the dump.

Micah Yoder
Prob with this is that my MySQL db's are ~2GB so far, so there would be at least half an hour of downtime between transferring the db. Is there a way to select/dump just the entries that have been modified across all db/table's?
ina
A: 

What I like to do is close the site and starting to move DB to other server using these commands: 2, then move all files (php ..etc) to the other server (if you have some store data or change files every hour, like image upload). and point the old server to the new DB server while the DNS is changing to all to the new server.

Qatari