I currently have a postfix server and dovecot server sharing files from an NFS server in the UK and the same config in Switzerland. I tried to mailsync but that appeared to lose emails, so then I tried doveadm replication but keeps coredumping and duplicating emails.

I've seen suggestions of using glusterfs and keepalived to manage virtual IPs, but this won't cut the mustard if the servers are on different subnets due to country.

Using keepalived to manage a virtual IP on the local LAN that switches between physical server and port-forward over the WAN, doesn't resolve the issue of split-brain.

Whilst the network is up, I think postfix file locking would be able to manage both postfix servers trying to access the same glusterfs, but what bothers me is split-brain when the network between servers is down, but local in-country networks are up.

Solution 1

Could it work to used DRBD to sync the filesystems from UK to Switzerland, and mail relay postfix from Switzerland to the master in UK, HAproxy redirecting dovecot to UK.

In scenario 1 "split-brain": emails that arrive in Switzerland are queued, and IMAP fails so the user manually reconnects to the current master server in UK.

In scenario 2 "UK postfix server crash", the Swiss server could be promoted to DRBD master, Swiss postfix stops relaying to UK, and HAproxy stops redirecting dovecot to the UK, the UK postfix would be configured upon repair to relay to Switzerland, and UK dovecot get HAproxy to Switzerland.

Does this sound a sensible solution? Or is there a better way, that doesn't get excessively complicated?

  • What is the operational requirement here: Do you actually need to continue delivering mail to both sides in case of a Channel netsplit? Why are you mentioning postfix locking: Is your mail not exclusively handed over to dovecot with only dovecot locking actually needed? – anx May 10 at 3:43
  • I don't need synchronous delivery of email in case of channel netsplit, I'm happy for it to sit in a queue until the link is restored. I just don't want the emails to be rejected. – banjo67xxx May 10 at 21:49
  • Postfix delivers email directly to /var/mail on one server, and Dovecot serves that email on a different server. You could be right that as postfix only appends to mail files, then dovecot is the only system that needs to use locking (I presume that postfix observes the .lock files though). – banjo67xxx May 10 at 21:55
  • I am not confident to put that as an answer because I have not properly tested it, but for reference: The included replications features of Dovecot should work just fine - if Dovecot is actually managing its mail storage. Meaning postfix handing mail to Dovecot via LMTP so Dovecot can immediately update index, as opposed to postfix writing directly into a shared directory. – anx Jun 4 at 9:50

Your Answer

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

Browse other questions tagged or ask your own question.