Comments on Mirror Your Web Site With rsync

This tutorial shows how you can mirror your web site from your main web server to a backup server that can take over if the main server fails. We use the tool rsync for this, and we make it run through a cron job that checks every x minutes if there is something to update on the mirror. Thus your backup server should usually be up to date if it has to take over.

9 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Anonymous

You should also add the parameter --numeric-ids to keep the value of the uid and gid of the file when its transfer.

By: Anonymous

As most websites these days are dynamic, you need to use different tools for mirroring.

I use wget to to create a mirror of my dyanmic pages.

By: Anonymous

I am mentioning rsync.net because I am a customer that wants to see their business thrive. Take a look at their philosophy and their privacy/warrant policy and you'll see why ...

I use rsync (and Unison, and sftp) to automatically backup my most important files to a 4 GB offsite filesystem at rsync.net, which they in turn replicate to their secondary loccation in Colorado.

It's a great solution. You should check them out.

By: Anonymous

About:

ssh-keygen -t dsa -b 2048 -f /root/rsync/mirror-rsync-key

 

DSA keys must be 1024 bits

 

ssh-keygen -t dsa -b 1024 -f /root/rsync/mirror-rsync-key

By:

If you are using ssh on a non-standard port quote the ssh part of the commands and include the port option.  For example...

rsync -avz -e 'ssh -p 8022' [email protected]:/var/www/ /var/www/


 

By: Mike

This is from around 1999 but still the very best rsync tutorial I've ever read: http://tinyurl.com/l37guv8

By: Greg

Thank you for the tutorial. I have port 22 closed for security reasons on the main server. How can I add another port into your script?

I can't get past this otherwise: rsync -avz -e ssh [email protected]:/var/www/ /var/www/

Thanks again!

By: Aamnah

the ssh command let's you specify a port with the -p flag. You can modify the script like so:

rsync -avz -e ssh -p 1234 [email protected]:/var/www/ /var/www/

By: Aamnah

rsync -avz -e "ssh -p 1243" [email protected]:/var/www/ /var/www/