I. Design purpose
Adapt to multi-users, large-capacity mail systems, easy to expand, provide Mail service redundancy characteristics.
Second. Configure the environment
My test environment uses three PC Server, which use Redhat 6.2, OpenLDAP2.0.7 and QMAIL-1.03 and qmail-ldap, which are used to run SMTP / POP3 service, and the specific configuration is as follows.
192.168.0.19 Omni1.i100.com.cn Main SMTP / POP3 Server, DNS MX Record, Mail Storage Host, QMQP Server
192.168.0.5 cocoon.i100.com.cn LDAP Server, Mail Storage Host
192.168.0.2 gw2.i100.com.cn message storage host, QMQP Server, at the same time is the second SMTP / POP3 Server
In 192.168.0.19 / data / vuser / directory, store Johnny's mail.
In 192.168.0.5 / data / vuser / directory, store Jacky's mail.
In 192.168.0.2 / var / qmail / vuser / directory, store Denny's mail.
Configured above in practice, can be configured as mail storage and LDAP, and SMTP Server is located in different machines.
three.
software
OpenLDAP-2.0.7.tgz
Qmail-1.03.tar.gz
Qmail-LDAP-1.03-20010301.patch
UCSPI-TCP-0.84.tar.gz
When compiling QMAIL, remember to compile the Cluster's support. Edit the makefile to reflect Your setup. You can change The Following Values: QLDAP-Cluster
Compiles The Clustering Code In. Note: This Doesn't Mean Clustering is on, IT Just Means You _Can_ Turn On Clustering. Default qmail is to support Cluster structures.
Four. LDAP and QMAIL installation
About LDAP and QMAIL installation, here, I give my LDAP's LDIF file:
DN: DC = I100, DC = COM, DC = CN
ObjectClass: TOP
ObjectClass: OrgniZation
DN: CN = Manager, DC = I100, DC = COM, DC = CN
Uid: Manager
ObjectClass: qmailuser
Mail: johnnys@cn.solution100.com
DN: CN = Johnny, DC = I100, DC = COM, DC = CN
CN: Johnny
Sn: johnny
ObjectClass: TOP
ObjectClass: Person
ObjectClass: inetorgperson
ObjectClass: qmailuser
Mail: johnny@i100.com.cn
Mailhost: Omni1.i100.com.cn
MAILALTERNATEDDRESS: Johnnys@i100.com.cn
MailMessagestore: / Data / Vuser / Johnny /
Mailquota: 51200
Uid: johnny
Userpass
Word: HSAMDAZCSDAOI
DN: CN = Jacky, DC = I100, DC = COM, DC = CN
CN: Jacky
SN: JackyObjectClass: Top
ObjectClass: Person
ObjectClass: inetorgperson
ObjectClass: qmailuser
Mail: jacky@i100.com.cn
Mailhost: cocoon.i100.com.cn
MAILALTERNATEDDRESS: Jacky@i100.com.cn
MailMessagestore: / Data / Vuser / Jacky /
Mailquota: 51200
Uid: Jacky
Userpassword: HSAMDAZCSDAOI
DN: CN = DENNY, DC = I100, DC = COM, DC = CN
CN: Denny
SN: Denny
ObjectClass: TOP
ObjectClass: Person
ObjectClass: inetorgperson
ObjectClass: qmailuser
Mail: Denny@i100.com.cn
Mailhost: gw2.i100.com.cn
MAILALTERNATEMDRESS: DENNY@i100.com.cn
MailMessagestore: / var / qmail / vuser / denny /
Mailquota: 51200
Uid: Denny
Userpassword: HSAMDAZCSDAOI
All above can see that I have existed the mail of the three users to different machines. If the user is more, the users at the beginning of A-N and O-Z are stored separately on different machines, respectively.
V. Basic System Configuration
INSTALL QMAIL with QMAIL-LDAP PATCH in three machines.
It is necessary to specifically configure related files under / var / qmail / control.
LDAPUID LDAPGID This is the UID and GID of system users who can read and write user email directories. There are different configurations on different machines; make sure this user has permission to read the user's mail directory.
LDA
PSERVER This file specifies the IP address of the LDAP server; if you want LDAP to have redundant effects, when the LDAP Server Down is, enabled LDAP Server, you can specify in this file.
Such as: ldap1.i100.com.cn: 389 ldap2.i100.com.cn:389 :)
LDAPSERVER This file content is 0 or 1, indicating whether to start the QMail Cluster mode. We are of course to start.
Echo 1> / VAR / QMAIL / Control / LDAPServer
6. QMAIL Cluster works principle
In allowed to allow Cluster's mail environment, each host can handle the message of the CLUSTER declaration; when a mail arrives at the master SMTP Server, QMAIL querying the MailHost property of the user in LDAP Server if the MailHost property is not specified. The host defined in this Server / VAR / QMAIL / Control / ME, this message is forwarded to the host defined by the QMQP protocol to Mailhost.
Note: All hostnames must be a legal DNS host name.
VI. Detailed configuration
Mail forwarding can be implemented on each system running QMAIL system. Need to set tcp.qmqp
File, define trusted Mailhost in this file.
As: 192.168.0.:Allow
: deny
The TCP.qmqp.cdb file is then generated with TCPRules.
Running / usr / local / bin / tc
PServer -v -x /var/qmail/control/tcp.qmqp.cdb
-u 502 -g 501 0 628 / var / qmail / bin / qmail-qmqpd 2> & 1 / var / qmail / bin / splogger QMQPD & Start QMAIL-QMQPD process, listen to 628 port.
On the client, use OE to set POP3 Server to the main SMTP / POP3 Server address (hereinafter 192.168.0.19), you can receive messages stored on 192.168.0.5 and 192.168.0.2. :)
8. About QMAIL-QMQPD Server
The distributed storage of the message is implemented, but as the user increases, the main SMTP / POP3 Server will become the bottleneck of the entire system; and once the main SMTP / POP3 Server Down, the entire system will no longer be effective.
The solution is to increase QMQPD Server.
The main SMTP / POP3 Server is 192.168.0.19, and my test environment is also the 192.168.0.2 as a QMQPD server; thereby, once 192.168.0.2 can continue to provide SMTP / POP3 service.
I simply uses manual DOWN to 192.168.0.19, and the POP3 and SMTP Server are set to 192.168.0.2 to confirm the feasibility of this method; and 192.168.0.2 is not the MX record of this domain declaration.
The above needs to add QMQPServers files in two QMQPD Server / Var / QMail / Control Directory, write a QMQPD Server IP address per line. :)
Nine. Others
If a WebMail feature is required, you can integrate with SQWwebmail. This scheme does not provide redundant measures stored for POP3, if possible, can be used in RAID, NFS, or SAN solutions.