Forum Moderators: phranque

Message Too Old, No Replies

Mirroring a site

Files, database, and all

         

MatthewHSE

1:47 pm on Apr 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm interested in learning how to mirror a website, completely, including files, directory structure, file/directory permissions, and MySQL database. Unfortunately I'm totally lost and don't know where to start. Basically, I want to keep a backup of my site between two servers. Only one copy of the site would be active and visited; the other would be only as a backup that I could point my nameservers at if my regular host went down or something.

How would I go about getting everything set up, or at least where can I start learning about what needs to be done?

Thanks,

Matthew

Romeo

2:28 pm on Apr 15, 2005 (gmt 0)

10+ Year Member



Hi Matthew,

depending on what you are allowed to do on your servers (shell commands, cron, have an rsyncd installed and running), you may look into rsync and a scenario like this:

The rsync could be scheduled by cron to run at fixed times daily to copy entire directories (and on further invocations keeping these directories in sync automatically by incremental transfers of new or changed files only -> runs fast and saves bandwidth).
If you do an automated export/mysqldump just minutes before the rsync schedule, that dump file would be included in the transfer, too.
On the 2nd server you could schedule some post processing to automatically import the mysql data.

The rsync needs a started server daemon on one side (the client on the other side can act both as sender or receiver). Additionally, since the rsync can run with ssh, all transfers would be secure.

Regards,
R.

KingMacro

11:19 pm on Apr 15, 2005 (gmt 0)

10+ Year Member



assuming you have full access to both servers then with the mysql servers there is also an ability to link 2 servers and have one as master and one as a read only slave.

That would give you realtime sql backups (as the sql database is likely be change more than the files) then i'd agree with the rsync for the files - although if they are rarely modified and the site is mainly stored in the database then it might be easier to do that manually when you update the files, depends how often they change.