When configured in a multi-server environment ( http://support.atmail.com/multiserver.html ), @Mail can be installed in a cluster to serve requests for POP3/IMAP, SMTP and Webmail sessions between multiple machines. Using a simple DNS round-robin configuration you can configure the services to load balance between multiple machines.
To proceed you must edit the DNS zone file for your domain, in this example the Bind/named nameserver will be used with the sample domain atmail.org. A similar procedure can be used for other nameserver configurations.
For a sample configuraiton we have 3 machines in the cluster. server1.atmail.org ( 66.45.163.146 ), server2.atmail.org ( 66.45.163.147 ) and server3.atmail.org ( 66.45.163.148 ) - All three machines have @Mail installed as per the installation procedure, and are using a shared mySQL database and NFS storage point for messages.
Firstly the MX records for atmail.org can be setup to point to all three machines. Via the MX records in the DNS server you need to specify a priority for the record, and mail-servers will generally connect in order for the MX priority. For the multi-server cluster we will configure all 3 servers to share the same MX prioirty, allowing inbound mail to be distributed between each server.
First each machine must be defined in the DNS zone file
server1 IN A 66.45.163.146
server2 IN A 66.45.163.147
server3 IN A 66.45.163.148
This points server1, server2 and server3.atmail.com to the prospective IP addresses
Next the DNS MX record can be defined to point to each machine, note 0 is used for the MX priority
atmail.org. IN MX 0 server1
atmail.org. IN MX 0 server2
atmail.org. IN MX 0 server3
This allows inbound messages to be routed to either machine in the cluster.
Next, for POP3/IMAP and Webmail services the domain mail.atmail.org is used for clients to connect via their external mail-client or viewing the Webmail interface. Using a similar approach with the DNS zone file, we can point the mail subdomain to resolve to each IP, allowing the remote client to cycle between each of the machines in the cluster. Note, if a machine is down in the cluster mail will be automatically routed to the next in order.
mail IN A 66.45.163.146
mail IN A 66.45.163.147
mail IN A 66.45.163.148
After applying the changes to the DNS zone file, restart the nameserver and verfiy the DNS changes are working. Using the "dig" utility under Linux you can query the nameserver and check the MX records are resolving correctly:
# dig atmail.org mx
;; QUESTION SECTION:
;atmail.org. IN MX
;; ANSWER SECTION:
atmail.org. 86400 IN MX 0 server3.atmail.org.
atmail.org. 86400 IN MX 0 server1.atmail.org.
atmail.org. 86400 IN MX 0 server2.atmail.org.
Note the DNS server returns the MX records resolves to all three servers. This allows inbound messages to be received by any machine in the cluster.
Next, using the nslookup utility under Linux or Windows, check the mail.atmail.org resolves to each IP successfully
# nslookup mail.atmail.org
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: mail.atmail.org
Address: 66.45.163.146
Name: mail.atmail.org
Address: 66.45.163.147
Name: mail.atmail.org
Address: 66.45.163.148
Once verified you can now begin using each of the 3 services in the cluster to accept Inbound/Outbound SMTP, POP3, IMAP and Webmail services. Note, if one of the machines is down in the cluster and the client tries to connect, the protocol will automatically cycle to the next IP address that resolves the domain for a successful connection.