
|
|
||||||||||||||||||


1 Introduction to Multiserver @Mail
Multiserver @Mail, is where you can install more than one copy of the software product, for clustering the mail-server or to load the Webmail interface between multiple machines.
@Mail can be clustered for both the WebMail client and Email-server mode of the software. Since @Mail uses mySQL to store all user data, and a central maildir storage point for the email-server mode, the software can be setup across multiple machines to increase performance.
Example network configuration of @Mail
2 Installing and configuring the first instance of @Mail.
This part of the multiserver install will be identical to the installation of @Mail in a single instance, for more information on installation and configuration, please view the Installation Guide, http://support.atmail.com.
You will also need to configure the POP3/IMAP server, http://support.atmail.com/pop3.html and the SMTP server, which is automatically configured from the installation script.
3 Mirroring @Mail to another location
First setup @Mail on one server, then replicate the installation directory to another machine.
tar -cvfz atmail.tgz /usr/local/atmail/
Next, move the archive to the second location via FTP/SCP
tar -xvfz atmail.tgz -C /
Next, run the install.pl script for the installation of @Mail on the new server. This will setup the machine as another instance for @Mail.
It is recommended to use a central NFS directory to share the following directory:
/usr/local/atmail/users/ - The maildir directory for user data ( Server mode only )
/usr/local/atmail/tmp/ - The global temporary directory for messages/attachments ( Server and client mode )
/usr/local/atmail/webmail/libs/Atmail/Config.pm - The global configuration file used by @Mail
The selected directory can be automatically symlinked to a mount point on an NFS server. This allows all the instances of @Mail to share a common configuration file and user-data
The next step is to configure mySQL to allow the new instance of @Mail to access the database.
Using the mySQL 'Grant' option you can allow the new server to access the database. Login to mySQL as root and run the following commands:
mysql> GRANT ALL PRIVILEGES ON atmail.* TO 'root'@'192.168.0.1' IDENTIFIED BY 'mypassword';
Query OK, 0 rows affected (0.00 sec)mysql> FLUSH PRIVILEGES;
Replace atmail with the database name on your server, and 192.168.0.1 with the IP address of the new server
5
Creating the remote NFS mount point
If you want the Maildir email message database to be stored on a remote server, the most practical means of doing this is to install it on a remote NFS mount. The webserver can access this mount everytime a user accesses an email; which can distribute the load over multiple servers.
The /usr/local/atmail/tmp/ directory must be shared via NFS. This is required for each frontend to access the single directory storage for attachments and temporary messages.
For this example, we will use the domains webserver.com (as the domain of the webserver) and database.com (for the database server).
First, add the following to the /etc/fstab file of the webserver:
database.com:/usr/local/atmail/users /usr/local/atmail/users nfs rw 0 0
database.com:/usr/local/atmail/tmp /usr/local/atmail/tmp nfs rw 0 0
Then, create an entry in the /etc/exports file of the database-server, which will give read/write permissions for that directory as an NFS mount:
/usr/local/atmail/users webserver.com(rw)
/usr/local/atmail/tmp webserver.com(rw)Then, on both servers, run the NFS service:
/etc/init.d/nfs restartThen, mount the NFS drive in your webserver:
mount -t nfs database.com:/usr/local/atmail/users /usr/local/atmail/users nfs
mount -t nfs database.com:/usr/local/atmail/tmp /usr/local/atmail/tmp nfs
You can then run the install.pl file of @Mail, which will automatically create the Maildir directory.
6
More details on clustering and sync
The utility rsync
Rsync can be used to synchronize your servers, it can be set as a cron job, ensuring that changes made to your system are transferred to your other servers.
If for example a HTML template or Perl script is edited on the master @Mail directory /usr/local/atmail/webmail/*, these changes will be automatically copied to the other servers. Note, the /usr/local/atmail/users directory should not be synced for server installations. This should be on an NFS mount
The principle is to have each copy of @Mail will reference the one MySQL server ( all database data is kept in the one MySQL database backend. ) . If using the Email-server mode of @Mail, a central NFS server can be setup as the mailbox storage for user accounts.
The following shell-script can be setup via Cron to sync the @Mail directory with other servers in the cluster:
/usr/bin/rsync -e ssh -avr --delete --exclude "users/" --exclude "tmp/" --exclude "spool/" root@master.yourserver.com:/usr/local/atmail /usr/local
Note Rsync must be successfully setup on both the Master server and the client machines.
If your hardware and OS are identical, you can also synchronize your httpd.conf and SMTP configuration files.
7
Configuring second instance of @Mail
There are several changes that need to be made to the second ( and subsequent ), instances of the @Mail server, these include:
- Removing the aab() reference from the Global.pm file ( /path-to-atmail/libs/Atmail/Global.pm ).
- Removing the chs() reference from the Auth.pm file and Global.pm ( /path-to-atmail/libs/Atmail/Auth.pm ).
- Configuring the MySQL server to allow read/write access to the atmail database from the server IP.
- Installing rsync on each machine in turn. This will allow you to sync the Webmail directory of @Mail to reflect changes from a global copy ( HTML templates, Perl scripts ).
Browser related articles from our online Knowledge-base regarding the Multi-server guide
- http://kb.atmail.com/view_article.php?num=114 - Optimizing and NFS performance
- http://kb.atmail.com/view_article.php?num=209 - Server optimization and @Mail
- http://kb.atmail.com/view_article.php?num=136 - Rsync Setup Instructions
- http://kb.atmail.com/view_article.php?num=580 - Creating an @Mail Server Mirror
The Calacode team are available for remote-installations of @Mail and assistance to setup the software with multiple servers. For additional support, please visit our web site http://atmail.com/ - Or send us an Email : support@CalaCode.com