1. Intro
Today in the age of internet almost all big companies and
organizations are facing a big problem how to process all received and
sent mail. Till today it was required to buy big, very expensive
servers to do the job, but now they can do the same much cheaper using
Clustered Mail Server.
1.1 What is Clustered Mail Server
From the outside it looks just like one big server which is serving
SMTP, imap4 and pop-3 protocols. In fact, it is composed of a number
of inexpensive computers. One of them is traffic manager, and the rest
are servers that process mail. The number of computers processing mail
is unlimited, but there can be only one active traffic manager.
1.2 What do we need for Clustered Mail Server
First we need a number of computers. They can be inexpensive one you
can buy in every computer store. Next we need a operating system. We
will be using the Linux[1] operating system. We can choose from
variety of Linux distributions, but in this tutorial we will focus on
Turbo Linux[2] or Red Hat Linux. For proper functioning of our
Clustered Mail Server we need one more product - Turbo Linux Cluster
Server 6.0[3]. Turbo Linux Cluster Server is an Enterprise-class
clustering solution that permits us to construct highly available and
scalable cluster of servers. In other words with this product we can
join our inexpensive servers in one big virtual server.
2. Planning
We will put together medium size Clustered Mail Server composed of
five computers. It will receive mail for the address
somebody@mail.my.org. First we need one computer, called atm.my.org,
for Traffic Manager (the ATM box in the figure). Then we will use
three computers for server nodes. We named them serv1.my.org,
serv2.my.org and serv3.my.org (you can find them as ``serv1\\\'\\\',
``serv2\\\'\\\' and ``serv3\\\'\\\' in the figure). Each server will serve two
services. serv1 will serve SMTP and POP3, serv2 will serve SMTP and
IMAP4 and serv3 will serve POP3 and IMAP4. The fifth computer, called
serv4.my.org (serv4 in the figure) will provide storage facilities for
mail.
----------------------------------------------------------------------
mail.my.org
|
+ - - - - - - - - - - - - | - - - - - - - - - - - - +
| +---+---+ |
| atm |
| | | |
| ATM |
| +---+---+ |
|
| | |
============================================
| | | | |
+---+---+ +---+---+ +---+---+
| | serv1 | | serv2 | | serv3 | |
| SMTP | | SMTP | | IMAP4 |
| | POP3 | | IMAP4 | | POP3 | |
+---+---+ +---+---+ +---+---+
| | | | |
============================================
| | |
|
| +---+---+ |
| serv4 |
| | | |
| NFS |
| +-------+ mail.my.org |
+ - - - - - - - - - - - - - - - - - - - - - - - - - +
---------------------------------------------------------------------
3. Execution
After we put together all the required hardware and connected
everything, we are ready to start building our Clustered Mail
Server. First of all we install the Linux Operating System on all five
computers.
We should just follow the instructions that came with our Linux
distribution. After we are finished with the installation of the
operating system, we have to install Turbo Linux Cluster Server
6.0. We need to install it only on the computer that will be the ATM,
but it is much easier to configure the cluster if we install it also
on servers serv1, serv2 and serv3.
Now we have to check if everything is installed. The programs we will
require are sendmail[4] (we use sendmail-8.9.3-20), imap[5]
(imap-4.7-5), nfs utils (nfs-utils-0.1.6-2) and Turbo Linux Cluster
Server 6.0[3]. Sendmail should be installed on servers serv1 and serv2
and imap on servers serv1, serv2 and serv3. Nfs utils should be
installed on servers serv1, serv2, serv3 and additionally on the
server serv4.
4. Configuration
4.1 Network File System Server
First, we have to edit /etc/exports file on serv4. We have to insert
line which contains the name of the directory which will be storing
mailboxes (eg. /disks/disk00) and domain in which we would like to
export the directory (in our case *.my.org) and attributes how we want
to export the directory. We will use rw - read/write and root_squash -
root user on client machines is not treated as root when accessing
files on the NFS server). So in the end the whole line we have to put
in to the file will be:
disks/disk00 *.my.org (rw, root_squash)
Now we have to tell the computer (serv4)to export the directory. We do
this by calling exportfs command and if everything went fine, we can
now mount /var/spool/mail directory on servers serv1, serv2 and serv3
(if it doesn\\\'t work you will have to reboot the computer serv4).
Next, we will configure the three servers to automatically mount the
exported directory on serv4. To do so we have to edit /etc/fstab file
on servers serv1, serv2 and serv3 and add the line:
serv4.my.org:/disks/disk00 /var/spool/mail nfs defaults 0 0
Which means we would like to mount exported Network File System (nfs)
directory /disks/disk00 from server serv4.my.org as /var/spool/mail on
localhost. Attribute defaults means that we would like to mount it
every time we reboot. The two zeros at the end of the line mean the
way that system checks the file systems (see man 5 fstab).
Next we must mount exported nfs directories. We use mount -a -t nfs on
serv1, serv2 and serv3 and Network File System is set up.
4.2 Sendmail[4] configuration
The sendmail that comes with the distributions we use is
preconfigured, so the only thing we have to change is that it will
accept the mail for our virtual server. We do that by adding
Djmail.my.org line in the /etc/sendmail.cf file after Dj$w.Foo.COM
line. If you can not find the mentioned line try searching for string
Dj or consult the documentation.
Since we want to use virtual server also as outgoing mail server, we
have to enable relaying of domains. To do so, we have to edit
/etc/mail/relay-domains file and add a line with domain .my.org of
computers which are allowed to use sendmail for relaying.
Finally, when we restart sendmail, it will start receiving mail for
mail.my.org and it will relay mail from domain my.org.
4.3 Imap[5] and pop[5] configuration
With the distributions we use imap and pop come already correctly
configured. For others you should check out the documentation that
came with the package.
4.4 Turbo Linux Cluster Server Configuration
We can configure Turbo Linux Cluster Server with turboclusteradmin or
we can do it by hand (only for experts). You can find the complete
clusterserver.conf file at the end of this section.
4.4.1 Network Mask
Defines the network mask used for communication between Advanced
Traffic Managers (ATM\\\'s).
NetworkMask 255.255.255.0
4.4.2 Users Checks
User Checks are required for checking the health of services on
servers. They can alert us when something irregular had happened. For
our virtual mail server we will need agents for smtp, pop and imap
services, so we will use smtpAgent, popAgent, imapAgent which comes
with Turbo Linux Cluster Server.
UserCheck smtpAgent
check /usr/bin/smtpAgent
EndUserCheck
UserCheck popAgent
check /usr/bin/popAgent
EndUserCheck
UserCheck imapAgent
check /usr/bin/imapAgent
EndUserCheck
4.4.3 Services
Services section defines which services are we going to serve on our
virtual server. We should put in smtp, imap, pop and also we have to
define protocol and port on which the service will be listening on
(ports 25 for SMTP, 110 for POP-3 and 143 for IMAP - see man 5
services).
Services
Service telnet tcp:23 none
Service smtp tcp:25 smtpAgent
Service pop tcp:110 popAgent
Service imap tcp:143 imapAgent
EndServices
4.4.4 Servers
In section servers we define which computers would we like to use as
servers. So we put in srv1, srv2 and srv3 and also we must define the
forwarding method to forward packets. There are three methods we can
chose from: NAT, direct and tunnel. We choose tunnel.
Servers
Server serv1 serv1.my.org tunnel
Server serv2 serv2.my.org tunnel
Server serv3 serv3.my.org tunnel
EndServers
4.4.5 Server Pool
Server Pool is an array of computers we would like to use in our
clustered mail server. We can have as many Server Pools as we like,
but we put all of our servers in one.
ServerPool ServerGroup1
AddServer serv1 smtp/1 pop/1
AddServer serv2 smtp/1 imap/1
AddServer serv3 pop/1 imap/1
CheckServerFrequency 30
CheckServerTimeout 10
CheckPortFrequency 30
CheckPortTimeout 10
EndServerPool
4.4.6 ATM Pool
In this section we define which computer can be the Advance Traffic
Manager, we choose that our only ATM will be atm.my.org.
AtmPool ATMs
AddAtm atm.my.org
SendArpDelay 20
MaxLostHeartbeats 3
HeartBeatDelay 1
NumConnections 100000
NumServers 1000
NumServices 100
ConnectionTimeout 30
EndAtmPool
4.4.7 Virtual Host
This section specifies the identity of our Clusterd Main Server to
world outside of the cluster. So put in mail.my.org. Next we have
define which Server Pool and which ATM pool we would like to use with
our virtual server, so we put in ServerGroup1 and Router.
VirtualHost mail.my.org
AddAtmPool ATMs
AddServerPool ServerGroup1
EndVirtualHost
4.4.8 Complete Turbo Linux Cluster Server configuration file
# TurboLinux Cluster Server config file /etc/clusterserver/clusterserver.conf
# *** global parameters ***
NetworkMask 255.255.255.0
# *** user checks ***
UserCheck smtpAgent
check /usr/bin/smtpAgent
EndUserCheck
UserCheck popAgent
check /usr/bin/popAgent
EndUserCheck
UserCheck imapAgent
check /usr/bin/imapAgent
EndUserCheck
# *** services ***
Services
Service telnet tcp:23 none
Service smtp tcp:25 smtpAgent
Service pop tcp:110 popAgent
Service imap tcp:143 imapAgent
EndServices
# *** servers ***
Servers
Server serv1 serv1.my.org tunnel
Server serv2 serv2.my.org tunnel
Server serv3 serv3.my.org tunnel
EndServers
# *** server pools ***
ServerPool ServerGroup1
AddServer serv1 smtp/1 pop/1
AddServer serv2 smtp/1 imap/1
AddServer serv3 pop/1 imap/1
CheckServerFrequency 30
CheckServerTimeout 10
CheckPortFrequency 30
CheckPortTimeout 10
EndServerPool
# *** router pools ***
AtmPool ATMs
AddAtm atm.my.org
SendArpDelay 20
MaxLostHeartbeats 3
HeartBeatDelay 1
NumConnections 100000
NumServers 1000
NumServices 100
ConnectionTimeout 30
EndAtmPool
# *** virtual hosts ***
VirtualHost mail.my.org
AddAtmPool ATMs
AddServerPool ServerGroup1
EndVirtualHost
#****EndFile***
4.5. Conclusion
Now everything is set and after we synchronize the configuration our
Clustered Mail Server should be working.
5. Advanced
After you have a running cluster you can add some advanced feature
like you can use one computer for server and ATM at the same time. Or
maybe add one more ATM to your router pool and get more robust
service.
6. Future reading
If you would like to know more about Turbo Linux Cluster Server you
should read Turbo Linux Cluster Server User Manual and also check out
man pages for subjects clusterserver.conf and NAT.
7. Useful links
[1] Linux - http://www.linux.org
[2] Turbo Linux - http://www.turbolinux.com/products/tls
[3] Turbo Linux Cluster Server - http://www.turbolinux.com/products/tcs
[4] Sendmail - http://www.sendmail.org
[5] Imap and pop - http://www.imap.org
|