Forum Moderators: bakedjake

Message Too Old, No Replies

Sync'ing MySQL DBs

Swapping Servers

         

iJeep

6:21 pm on Mar 17, 2004 (gmt 0)

10+ Year Member



I am switching servers for my site and have everything working. I just can't figure out how to seamlessly move the database from one to the other without interupting operations.

I was thinking about having the current server send a dump directly the MySQL running on the other server through TCP so I don't have to download and upload.

Is that the best way to do it?

SeanW

1:53 am on Mar 18, 2004 (gmt 0)

10+ Year Member



It would depend on how often writes happen. If you could pause any writes to the DB, what you are suggesting will work.

If you have frequent writes, and are running a version of mysql that supports it, you could look at setting up replication and doing a graceful failover.

Sean

MattyMoose

5:07 pm on Mar 18, 2004 (gmt 0)

10+ Year Member



You could also try MySQL Replication...

/* Digs up MySQL Link */
[mysql.com ]

That might do what you're asking for, but maybe not...

The best way, IMHO, if you want a true copy of your DB is to down your site with a "maintenance page" ("We are currently down for regularly scheduled maintenance, blah blah"), and shut down mysql (if you can. If you can't, that's probably ok as well, since there won't be any writes to your DB, since the site is under maintenance), and copy/tar your actual database files.

Now, I'm constantly reminded by a friend of mine that I come up with these solutions that are really good, but only if you're the administrator of your own boxes, which many people aren't, so they can't perform many of the actions I describe... Saying that, are you able to do any/part of that? If so, that's the way I'd go.

--MM

[Edit:]
Whoops! I missed SeanW's suggestion of Replication. Sorry!
[/Edit]

jamie

12:46 pm on Mar 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi ijeep,

i've just been trying out SQLyog which sync's mysql databases. the windows version costs, but the linux version is free. i have it running on a cronjob to sync my test and live dbs at home and online respectively.

cheers

iJeep

3:17 pm on Mar 23, 2004 (gmt 0)

10+ Year Member



I ended up writing a simple script to dump all of the tables straight to the new database and did it at about 3am so there wasn't much affected. I think it took about 5 min total.