Score:1

Scaling Postfix/Dovecot-Server

zw flag

I looked at a larger installation of my local university of a Mailserver with Postfix/Dovecot. I am trying to archieve the same and looking forward to get any input or search query about how this could be built by myself.

  1. There is a mx Record on a mi (mail-in), researching, there are two mail-in-Servers that use dovecot (mx1/mx2). They are both working parallel. (Here I do not know how the best server is selected, there is no secondary MX record with another priority) The same seems to apply to the Mail-Out Servers (there are some of them) that a software chooses the best one.
  2. There are about 8 Mailbox-Servers (mbx1....), the data is saved on one of these. If I set one domain (f.e. mail-in.xxxx) how can I set up Dovecot to automatically select the correct server.
  3. The Server seems to use some type of technical automatization to (re)distribute accounts. Is that a feature that already exists or is this custom coded?

I am looking forward to some keywords I could look into to archieve this kind of setup. Thanks in advance,

Lukas

anx avatar
fr flag
anx
Beware that many helpful mechanisms present in mail server software were rooted in what a single piece of equipment could do in 2006. Hardware improvements have since for many years outperformed the increase in user needs. Nowadays.. even a *large* installation will have a greater share of its complexity invested into reducing the probability or impact of data loss or outages, instead of plain load balancing.
Lukas avatar
zw flag
Hi anx, do you mean that the focus should be more on the backup strategy (data loss)? I want to build the multiple Storage-Server-System to not scale up indefinitely on a single server and to not have a single point of failure. Can you please elaborate?
Score:0
au flag

I would look into the following

  • Using DNS to distribute incoming SMTP connections between multiple servers. This can be done with multiple A records for outbound email (smtp.example.net), and multiple MX records with the same priority for inbound email. (Inbound connections should be fairly evenly distributed between servers if the MX records all have the same priority.)
  • Having your front-end inbound servers just foward emails to [email protected], where X is the ID/number of the storage server that user is allocated to.
  • Run a pretty basic postfix/dovecot setup on the storage servers
  • Using something like nginx as a load balancer / proxy for IMAP (possibly also for outbound SMTP). This is also capable of authenticating IMAP/SMTP connections and proxying to a specific backend server depending on the auth response. For example you could have multiple nginx servers terminate & authenticate IMAP connections, then proxy to the correct server by using a fairly simple web app that replies with the correct storage server to nginx. https://docs.nginx.com/nginx/admin-guide/mail-proxy/mail-proxy/#mail_auth
  • You'll either want to get everything working with SQL auth so all servers communicate with central SQL servers (or a bunch of read-only mirrors), or have some custom code for deploying config/users across the whole lot

I don't think anything that can do this "out of the box" with dovecot/postfix, but it's mainly just down to configuration.

Lukas avatar
zw flag
Hi dear, thank you for this information. This is some great input. I upvoted and it has been recorded.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.