rsync Mirroring

http://www.howtoforge.com/mirroring_with_rsync

Source Server Configuration
Create an unprivileged user that can access the files you want and give that user a password:

useradd -d /home/mirror -m -s /bin/bash mirror
passwd mirror

Switch to that user and go the home directory:

su mirror
cd ~

Create a few test files:

touch test.txt help.txt mirror.txt

Destination server
Test rsync the connection to the remote server:

rsync -avz --delete -e ssh mirror@<SOURCE SERVER ADDRESS>:/home/mirror /tmp/mirror/

If your SSH is listening on a different port:

rsync -avz --delete -e "ssh -p <portnumber>" mirror@<SOURCE SERVER ADDRESS>:/home/mirror /tmp/mirror/

Options

  • --delete - Deletes files on the destination that don't exist on the source
  • --exclude=<files to exclude> - don't synch the specified file(s)
  • --no-links - skip symbolic links
  • -C - ignore CVS files (.svn, etc)

Using public key authentication will eliminate the need for entering a password, allowing you to automate the rsync using cron.

Technology:

Recent Updates

  • 1 year 12 months ago
  • 1 year 12 months ago
  • 1 year 12 months ago
    php 8.x
  • 2 years 7 hours ago
    10.6.7
  • 2 years 1 day ago
    Drop Centos 5/6 stuff