1. IntroToday in the age of internet almost all big companies andorganizations are facing a big problem how to process all received andsent mail. Till today it was required to buy big, very expensiveservers to do the job, but now they can do the same much cheaper usingClustered Mail Server.1.1 What is Clustered Mail ServerFrom the outside it looks just like one big server which is servingSMTP, imap4 and pop-3 protocols. In fact, it is composed of a numberof inexpensive computers. One of them is traffic manager, and the restare servers that process mail. The number of computers processing mailis unlimited, but there can be only one active traffic manager.1.2 What do we need for Clustered Mail ServerFirst we need a number of computers. They can be inexpensive one youcan buy in every computer store. Next we need a operating system. Wewill be using the Linux[1] operating system. We can choose fromvariety of Linux distributions, but in this tutorial we will focus onTurbo Linux[2] or Red Hat Linux. For proper functioning of ourClustered Mail Server we need one more product - Turbo Linux ClusterServer 6.0[3]. Turbo Linux Cluster Server is an Enterprise-classclustering solution that permits us to construct highly available andscalable cluster of servers. In other words with this product we canjoin our inexpensive servers in one big virtual server.2. PlanningWe will put together medium size Clustered Mail Server composed offive computers. It will receive mail for the addresssomebody@mail.my.org. First we need one computer, called atm.my.org,for Traffic Manager (the ATM box in the figure). Then we will usethree 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 twoservices. serv1 will serve SMTP and POP3, serv2 will serve SMTP andIMAP4 and serv3 will serve POP3 and IMAP4. The fifth computer, calledserv4.my.org (serv4 in the figure) will provide storage facilities formail.---------------------------------------------------------------------- mail.my.org | + - - - - - - - - - - - - | - - - - - - - - - - - - + | +---+---+ | | atm | | | | | | ATM | | +---+---+ | | | | | ============================================ | | | | | +---+---+ +---+---+ +---+---+ | | serv1 | | serv2 | | serv3 | | | SMTP | | SMTP | | IMAP4 | | | POP3 | | IMAP4 | | POP3 | | +---+---+ +---+---+ +---+---+ | | | | | ============================================ | | | | | +---+---+ | | serv4 | | | | | | NFS | | +-------+ mail.my.org | + - - - - - - - - - - - - - - - - - - - - - - - - - +---------------------------------------------------------------------3. ExecutionAfter we put together all the required hardware and connectedeverything, we are ready to start building our Clustered MailServer. First of all we install the Linux Operating System on all fivecomputers.We should just follow the instructions that came with our Linuxdistribution. After we are finished with the installation of theoperating system, we have to install Turbo Linux Cluster Server6.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 alsoon servers serv1, serv2 and serv3.Now we have to check if everything is installed. The programs we willrequire 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 ClusterServer 6.0[3]. Sendmail should be installed on servers serv1 and serv2and imap on servers serv1, serv2 and serv3. Nfs utils should beinstalled on servers serv1, serv2, serv3 and additionally on theserver serv4.4. Configuration4.1 Network File System ServerFirst, we have to edit /etc/exports file on serv4. We have to insertline which contains the name of the directory which will be storingmailboxes (eg. /disks/disk00) and domain in which we would like toexport the directory (in our case *.my.org) and attributes how we wantto export the directory. We will use rw - read/write and root_squash -root user on client machines is not treated as root when accessingfiles on the NFS server). So in the end the whole line we have to putin 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 dothis by calling exportfs command and if everything went fine, we cannow 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 theexported directory on serv4. To do so we have to edit /etc/fstab fileon servers serv1, serv2 and serv3 and add the line: serv4.my.org:/disks/disk00 /var/spool/mail nfs defaults 0 0Which means we would like to mount exported Network File System (nfs)directory /disks/disk00 from server serv4.my.org as /var/spool/mail onlocalhost. Attribute defaults means that we would like to mount itevery time we reboot. The two zeros at the end of the line mean theway that system checks the file systems (see man 5 fstab).Next we must mount exported nfs directories. We use mount -a -t nfs onserv1, serv2 and serv3 and Network File System is set up.4.2 Sendmail[4] configurationThe sendmail that comes with the distributions we use ispreconfigured, so the only thing we have to change is that it willaccept the mail for our virtual server. We do that by addingDjmail.my.org line in the /etc/sendmail.cf file after Dj$w.Foo.COMline. If you can not find the mentioned line try searching for stringDj or consult the documentation.Since we want to use virtual server also as outgoing mail server, wehave 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 ofcomputers which are allowed to use sendmail for relaying.Finally, when we restart sendmail, it will start receiving mail formail.my.org and it will relay mail from domain my.org.4.3 Imap[5] and pop[5] configurationWith the distributions we use imap and pop come already correctlyconfigured. For others you should check out the documentation thatcame with the package.4.4 Turbo Linux Cluster Server ConfigurationWe can configure Turbo Linux Cluster Server with turboclusteradmin orwe can do it by hand (only for experts). You can find the completeclusterserver.conf file at the end of this section.4.4.1 Network MaskDefines the network mask used for communication between AdvancedTraffic Managers (ATM\\\'s). NetworkMask 255.255.255.04.4.2 Users ChecksUser Checks are required for checking the health of services onservers. They can alert us when something irregular had happened. Forour virtual mail server we will need agents for smtp, pop and imapservices, so we will use smtpAgent, popAgent, imapAgent which comeswith Turbo Linux Cluster Server. UserCheck smtpAgent check /usr/bin/smtpAgent EndUserCheck UserCheck popAgent check /usr/bin/popAgent EndUserCheck UserCheck imapAgent check /usr/bin/imapAgent EndUserCheck4.4.3 ServicesServices section defines which services are we going to serve on ourvirtual server. We should put in smtp, imap, pop and also we have todefine 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 5services). Services Service telnet tcp:23 none Service smtp tcp:25 smtpAgent Service pop tcp:110 popAgent Service imap tcp:143 imapAgent EndServices4.4.4 ServersIn section servers we define which computers would we like to use asservers. So we put in srv1, srv2 and srv3 and also we must define theforwarding method to forward packets. There are three methods we canchose 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 EndServers4.4.5 Server PoolServer Pool is an array of computers we would like to use in ourclustered 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 EndServerPool4.4.6 ATM PoolIn this section we define which computer can be the Advance TrafficManager, 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 EndAtmPool4.4.7 Virtual HostThis section specifies the identity of our Clusterd Main Server toworld outside of the cluster. So put in mail.my.org. Next we havedefine which Server Pool and which ATM pool we would like to use withour virtual server, so we put in ServerGroup1 and Router. VirtualHost mail.my.org AddAtmPool ATMs AddServerPool ServerGroup1 EndVirtualHost4.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/smtpAgentEndUserCheckUserCheck popAgent check /usr/bin/popAgentEndUserCheckUserCheck imapAgent check /usr/bin/imapAgentEndUserCheck# *** services ***Services Service telnet tcp:23 none Service smtp tcp:25 smtpAgent Service pop tcp:110 popAgent Service imap tcp:143 imapAgentEndServices# *** servers ***Servers Server serv1 serv1.my.org tunnel Server serv2 serv2.my.org tunnel Server serv3 serv3.my.org tunnelEndServers# *** 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 10EndServerPool# *** router pools ***AtmPool ATMs AddAtm atm.my.org SendArpDelay 20 MaxLostHeartbeats 3 HeartBeatDelay 1 NumConnections 100000 NumServers 1000 NumServices 100 ConnectionTimeout 30EndAtmPool# *** virtual hosts ***VirtualHost mail.my.org AddAtmPool ATMs AddServerPool ServerGroup1EndVirtualHost#****EndFile***4.5. ConclusionNow everything is set and after we synchronize the configuration ourClustered Mail Server should be working.5. AdvancedAfter you have a running cluster you can add some advanced featurelike you can use one computer for server and ATM at the same time. Ormaybe add one more ATM to your router pool and get more robustservice.6. Future readingIf you would like to know more about Turbo Linux Cluster Server youshould read Turbo Linux Cluster Server User Manual and also check outman 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 |