Rsync Setup Instructions (Multiserver)
rsync is a powerful tool that allows you to synchronize the contents of your servers (i.e., configuration files, spamassassin .cf filters and the like). They are specially useful if you are doing the multiserver installation of @Mail, and want to load-balance the stress across multiple servers.
This article details the process of creating an Rsync master and a client. For illustrative purposes in this example, the Rsync master hostname will be called "Master-Foo-01" - the Client hostname will be called "Slave-Foo-02":
1.) Create a SSH public key on the Master server:
atmail@master-foo-01# ssh-keygen -t rsa
2.) This will produce a public key in /home/atmail/.ssh/id_rsa.pub. Copy the .pub file to the Slave machine:
atmail@master-foo-01# scp /home/atmail/.ssh/id_rsa.pub root@slavae-foo-02:/home/atmail/.ssh/id_rsa.pub
3.) Pipe the public key into a file called authorized_keys, in your .ssh directory.
atmail@slave-foo-02# cat /home/atmail/.ssh/id_rsa.pub >> authorized_keys
4.) Make sure that the authorized_keys file, and all of the contents of the .ssh directory have 600 permissions:
atmail@slave-foo-02# chmod 600 /home/atmail/.ssh/*
5.) Try to login, sans password, from the Master Machine to the Client machine.
atmail@master-foo-01# ssh atmail@slave-foo-02
6.) If it logins successfully, go on to instruction 7. Otherwise, redo the key-gen process, or check the permissions of your SSH directory.
7.) Create the file "/home/atmail/rsyncservers.sh" in the master server, that contains the following:
#!/bin/sh /usr/bin/rsync -e ssh -avr --delete /usr/local/atmail/webmail/ atmail@slave-foo-02:/usr/local/atmail/webmail/ /usr/bin/rsync -e ssh -avr --delete /usr/local/atmail/mailserver/configure atmail@slave-foo-02:/usr/local/atmail/mailserver/configure /usr/bin/rsync -e ssh -avr --delete /usr/local/atmail/mailserver/etc/ atmail@slave-foo-02:/usr/local/atmail/mailserver/etc/ /usr/bin/rsync -e ssh -avr --delete /usr/local/atmail/av/etc/ atmail@slave-foo-02:/usr/local/atmail/av/etc/ /usr/bin/rsync -e ssh -avr --delete /usr/local/atmail/spamassassin/etc/ atmail@slave-foo-02:/usr/local/atmail/spamassassin/etc/
8.) Give it execute permissions:
atmail@master-foo-01# chmod 755 /home/atmail/rsyncservers.sh
9.) Place the following entry in /etc/crontab:
01,10,20,30,40,50 * * * * atmail /home/atmail/rsync-servers.sh
Your rsync service should now check every 10-minutes for altered files, and synchronize when necessary.

