Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[EXIM/DOVECOT] Redundant mail servers
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Belliash
Advocate
Advocate


Joined: 24 Nov 2004
Posts: 2428
Location: Wroclaw, Poland

PostPosted: Fri Aug 26, 2016 6:29 pm    Post subject: [EXIM/DOVECOT] Redundant mail servers Reply with quote

Hello,

I am facing a conceptional problem with a redundant mail servers setup.
The idea is to setup 2 mail servers in 2 different locations, each having Exim for SMTP and Dovecot for IMAP installed.

What i would like to achieve, is to eliminate a single point of failure. The goal here is not to get a consistency guarantee that any accepted e-mail will be available even if a server goes down, as there is still a chance that some e-mails will be lost until the server that received it comes back online. Instead, I would like to have guaranteed the following properties in case one of mail servers would go down:
1) New e-mails can be delivered via SMTP and then accessed by users via IMAP
2) New mails can be sent

What is more, when 2 servers will be reachable, all mails should be available to all users, whether they have been received by 1st of 2nd server.

Actually I thought about using the following technologies:
1) 2 MX sections in DNS with 1 and 10 priorities, so that 1st SMTP server would be used by default and 2nd one only when 1st goes down
2) Dovecot providing IMAP access installed on both machines and receiving mails only from local Exim
3) Users would be able to connect to both IMAP servers via round-robin in DNS
4) Dovecots should synchronize each other, otherwise consistences might occur (master/master replication?)


However, I am not sure if above problem cannot be solved in more elegant way.
I think the biggest problem here is that both servers will be running in different locations and they would connect to each-other only over the Internet or VPN. Using some clustered FS like GlusterFS would be rather a pain in this scenario.

Also I am not sure how to implement user management. Actually I got 1 mail server with backed in MySQL. Having 2 such server would mean, that I need to add or remove user on both of them.


Do you know about an already working solution in similar scenario?
_________________
Asio Software Technologies
Belliash IT Weblog
Back to top
View user's profile Send private message
C5ace
Apprentice
Apprentice


Joined: 23 Dec 2013
Posts: 265
Location: Brisbane, Australia

PostPosted: Sat Aug 27, 2016 10:09 am    Post subject: Reply with quote

Have a look at ispconfig.org for inspiration. They support Mirrored Clusters. No support for Gentoo unless you add symlinks to Gentoo to emulate Debian or Ubunto.
Back to top
View user's profile Send private message
Belliash
Advocate
Advocate


Joined: 24 Nov 2004
Posts: 2428
Location: Wroclaw, Poland

PostPosted: Sun Aug 28, 2016 8:14 am    Post subject: Reply with quote

Well... I think that IMAP can be even configured as a singleton.
Anyway, I would need 2 SMTP servers up and running. Another scenario guarantees that:
1) 1st SMTP server would be configured with all its users, rules, clamav, spamassassin etc and would be storing all mails in maildir.
2) 2nd SMTP server would need to receive all mails and pass them to 1st one.
3) If first SMTP server goes down, 2nd one should retry mail delivering once per hour, until it reaches destination.
4) If 1st SMTP server rejects mail, eg due to virus attached, such information should be sent to 2nd SMTP server and it should send some notification to original sender.
5) 2nd SMTP server should not allow to send any mails (it would be used only as a kind of fail-over proxy for 1st one).
_________________
Asio Software Technologies
Belliash IT Weblog
Back to top
View user's profile Send private message
Syl20
Guru
Guru


Joined: 04 Aug 2005
Posts: 550
Location: France

PostPosted: Wed Aug 31, 2016 1:50 pm    Post subject: Reply with quote

I think you need a High-Availability solution, like corosync/pacemaker/pcs, to set up a "real" cluster. Some documentation here.
Bidirectional synchronization is a pain, but there are several ways to do. Like DRDB, for example. And two crossed master/slave replications for MySQL, or Galera for MariaDB.
Back to top
View user's profile Send private message
Belliash
Advocate
Advocate


Joined: 24 Nov 2004
Posts: 2428
Location: Wroclaw, Poland

PostPosted: Fri Sep 02, 2016 6:45 pm    Post subject: Reply with quote

I think the main problem is location. One server is located in France, while second in Poland ;-)
Both has symmetrical 100mbps connection, but still cluster over the net is a pain.
_________________
Asio Software Technologies
Belliash IT Weblog
Back to top
View user's profile Send private message
Syl20
Guru
Guru


Joined: 04 Aug 2005
Posts: 550
Location: France

PostPosted: Mon Sep 05, 2016 1:53 pm    Post subject: Reply with quote

Argl ! Indeed. I missed this.

That said, if you plan to keep the MySQL backend, the bidirectional replication is still a good solution.
If the mail boxes are in maildir format, perhaps unison is an interesting option. I also found this, but I never tested it.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum