Knowledgebase

PHP/MySQL Database Sync

Posted by KMyers, 02-15-2010, 09:56 PM
Hello,

Posted by SqueakSoft, 02-15-2010, 10:48 PM
If you want an up-to-the-second copy of your database, you could look at MySQL replication. It's not terribly difficult to set up and would allow you to quickly get up and running on your backup machine. Of course, if your primary box decides to wipe out your database (if you get hacked or make a mistake in a query, for instance) then your replica would get wiped out too, but it would protect you from hardware and network failures. Hopefully you're doing off-site backups of this information anyway, right? If so, can't you just use that when the live data is lost? A simple shell script that does a mysqldump followed by a rsync/scp/etc would work fine. Hopefully your live database doesn't need restoring too often, so a little downtime while you re-import the data is acceptable. You could get fancier and use mysql binary logs to sync more frequent backups throughout the day and avoid locking tables with a mysqldump.

Posted by TheSimpleHost-Nathan, 02-16-2010, 05:20 AM
If I was you this is what I would do. Server A is your main server and server B is your second server. 1. Server A tar's up two files, 'files' and 'sql' nightly at 1 AM 2. Server B connects to server A and copies across the two tar files at 2 AM 3. Server B then untars them 4. Server B removes the old files and drops the old tables and then copies the new files across and inserts the latest SQL. Alternatively, just use WHMCS's built in backup utility that gets the DB sent over once a day.

Posted by OpenInternet-Vince, 02-16-2010, 06:39 AM
I think WHMCS does allow you to have round robin copies of WHMCS running. You just need to contact them for it. If you are able to do that, then all you need is an external mysql server. No need to run sync between them. That probably should be the easiest solution.

Posted by SqueakSoft, 02-16-2010, 11:10 AM
I haven't heard of any clustered WHMCS options and can't find any in their documentation. That'd be pretty handy if it existed, but it sounds like a lot of work for them to implement since it would have to take care of the syncing in the background. In any case, you will definitely need to talk to them about authorizing the installation to run on a second server. Their docs say:

Posted by SqueakSoft, 02-16-2010, 11:13 AM
Sorry.. I just re-read that and you said "external mysql server". If WHMCS will let you run multiple copies, that would work, but that's another single point of failure that would take out both instances of WHMCS if it failed.



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
Lowest Hosting Down??? (Views: 664)


Language:

Client Login

Email

Password

Remember Me

Search