I am in charge of setting up our company email infrastructure and have a question on how to setup redundant pop/IMAP servers. I understand that I can setup failover for inbound email using MX records but how do you setup the same type of thing for email retrieval? If our mail server goes down I don't want to have to go to every computer and change the email settings.

POP/IMAP uses A records for DNS? If so, would the solution be to manually change the A record to point to the backup mail server if the primary server went offline?

Any thoughts or suggestions would be greatly appreciated.

  • POP and IMAP are radically different, so you need to start by deciding which you're going to use. (No time right now for a longer answer...) – Ward - Reinstate Monica May 8 '12 at 3:42
  • @Ward I understand they are different but I don't see how it matters when I am looking for redundancy in case of a server failure. Both services can run on the same server. – thiesdiggity May 8 '12 at 4:12

Switching the DNS record is by far the simplest and least invasive way of doing what you want to acheive, but be aware that it's not foolproof. Depending on how well behaved the clients DNS is, it may cache old records for an extended period of time.

If a bit of downtime is acceptable, then set your TTL of your A record to a small value (say, 5-10 minutes). In the even of a failure, most of your users should be back online within 10 minutes.

If you want to provide more redundancy than this, then you need to decide what sort of failure you're trying to mitigate - server failure, or connectivity failure?

Server failure is fairly straight forward - use a load balancer (it needs to be a Layer 4 load balancer. A lot of load balancer are Layer 7 and inspect the inbound traffic, this is not really nessesary for something as simple as this). to redirect requests to one server, until that server goes offline, then redirect them to another. So the load balancer will own the public IP address, and it then takes care of the communications. Or, you set up a heartbeat between the two servers, they both have configs for the same IP address, but only one of them owns it at any given time. In the event of a heartbeat failure, the 2nd server takes over the IP address and starts serving requests.

If you want to mitigate connectivity failure (i.e. a failure of your inbound connection) and fall over to a remote site, that's far too complicated for a simple answer here.

  • Very interesting. I am more worried about server failure than connectivity problems since all of our servers are in a data center. I take it a load balancer is a hardware device? – thiesdiggity May 8 '12 at 4:04
  • @thiesdiggity - not always. A hardware device is simply a specialied computer that runs software. For example, there's software called haproxy which is a very popular Layer 7 HTTP load balancer. However, then you have to ask - what happens if my load balancer has a failure? Then you combine the two thigns I described above. You have two load balancer, and each load balancer runs a heartbeat, and then when one fails, the other takes over. But then you have to ask - why not just implement the heartbeat on the servers themselves! One less point of failure and the same architecture. – Mark Henderson May 8 '12 at 4:11
  • And the answer is then "Well, why not?" - and that may certainly be the way to go. But setting up heartbeats isn't exactly simple. A single instance load balancer is generally much easier to set up and keep online and can handle most outages (e.g. planned outages or single server failures). – Mark Henderson May 8 '12 at 4:12
  • (it's worth noting in my trivial example above that it makes it sound like load balancers are sort of useless. This is far, far, far from the truth. But I used it to demonstrate how a load balancer can be used for redundancy failover. That's not their primary role) – Mark Henderson May 8 '12 at 4:18
  • Thank you very much for your input. I think I will research or price out layer 4 switches since I need one for our cabinet anyway. once I get that setup I will look into the heartbeat model. thanks again! – thiesdiggity May 8 '12 at 4:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.