Synchronizing filesystems with rsync

Synchronizing multiple boxes can be important for multiple reasons, high-availability, disaster recovery, poor mans backups, etc... Here is a quick tutorial on using rsync to synchronize a couple of boxes. In this example one box is the master one is the slave. WARNING, this approach isn't the most secure... you should look into the auth users option, especially if you are doing this on the Internet and not your internal network.

On the slave, create a /etc/rsyncd.conf file with these contents:
[mirror1]
path = /place/to/mirror/to1
uid = SYNCUSER
gid = SYNCGROUP
read only = false
hosts allow = MASTERHOSTNAME
hosts deny = all

[mirror2]
path = /place/to/mirror/to2
uid = SYNCUSER
gid = SYNCGROUP
read only = false
hosts allow = MASTERHOSTNAME
hosts deny = all

On the master create a cron job that will sync the boxes on a schedule, this sync's the boxes every 4 hours:
0 0,4,8,12,16,20 * * * rsync -av --delete /path/to/sync/from1 rsync://SLAVEHOSTNAME/mirror1 > /dev/null
0 0,4,8,12,16,20 * * * rsync -av --delete /path/to/sync/from2 rsync://SLAVEHOSTNAME/mirror2 > /dev/null