3

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.

thiesdiggity
  • 437
  • 1
  • 9
  • 22
  • 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 - Trying Codidact May 08 '12 at 03: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 08 '12 at 04:12

1 Answers1

4

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.

Mark Henderson
  • 68,823
  • 31
  • 180
  • 259
  • 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 08 '12 at 04: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 08 '12 at 04: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 08 '12 at 04: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 08 '12 at 04: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 08 '12 at 04:28
  • @thiesdiggity - Most load balancers operate at Layer 4 or Layer 7. Switches operate at Layer 3. No such thing as a Layer 4 switch. Most switches are Layer 2, and it's expensive to jump to a Layer 3 switch. So if you need a switch, you will need a load balancer or heartbeat in addition to that (they are two parts of the same puzzle) – Mark Henderson May 08 '12 at 04:38