Page 1 of 1

Secondary MX

Posted: Wed Apr 13, 2016 5:59 pm
by SS88
Hello.

Has anyone got this working? I wouldn't called it Mail Clustering but if MX 1 goes offline, MX 2 takes over and accepts the e-mails until MX 1 is back online. Once it's back online it delivers them.

Anyone have experience with this?

Re: Secondary MX

Posted: Wed Apr 13, 2016 7:06 pm
by Spheerys
I'm interested too !

Re: Secondary MX

Posted: Wed Apr 13, 2016 7:11 pm
by mehargags
This indeed is "clustering" so that the servers sync up the data (mails) with each other. If one server goes down the other is taking in the "calls" for incoming and outgoing. This is not supported in VestaCP yet (to my best guess) but you can setup secondary MX using some guides on internet

Re: Secondary MX

Posted: Wed Apr 13, 2016 7:12 pm
by SS88
I've found it out! :)

I'll post soon.

Re: Secondary MX

Posted: Wed Apr 13, 2016 7:13 pm
by SS88
mehargags wrote:This indeed is "clustering" so that the servers sync up the data (mails) with each other. If one server goes down the other is taking in the "calls" for incoming and outgoing. This is not supported in VestaCP yet (to my best guess) but you can setup secondary MX using some guides on internet

Yes, my solution that I have working is a relay. So users cannot connect to MX2 to send / receive but MX2 will send e-mails back to MX1 when it's back online.

Re: Secondary MX

Posted: Wed Apr 13, 2016 7:36 pm
by SS88
Okay soo...

I'm on Debian so the paths are correct for me, usually different for others.
  • First set-up the second server (can be a separate install of Vesta or just a stripped down version) with VestaCP. Make sure it's got Exim installed.
  • Create a file /etc/exim4/mx_domains on the second server and populate it with the domains separated by a new line you it to accept mail for. (i.e. yourdomain.com)
  • Change the file /etc/exim4/exim4.conf.template and find the line domainlist relay_to_domains = dsearch;/etc/exim4/domains/ and change it to: domainlist relay_to_domains = dsearch;/etc/exim4/domains/ : lsearch;/etc/exim4/mx_domains
  • Restart Exim.
  • Go to https://www.wormly.com/test_smtp_server and send a test email (i.e. [email protected]). Make sure the SMTP Server field is the IP address of your second VestaCP server.
  • It should report it's been accepted, and then after a short while you should receive the test e-mail to your main mail server.
  • If testing succeeded and you receive the e-mail you can now set-up the second MX record with a higher priority (i.e. 20). When MX1 is offline, MX2 will receive the e-mails. When MX1 is back online, MX2 will send the emails to MX1.

Re: Secondary MX

Posted: Sat Jul 09, 2016 6:00 am
by raenk
Got it working making sure the domains aren't setup for mail support on secondary servers. Domains shouldn't exist in /etc/exim/domains

Re: Secondary MX

Posted: Mon Jul 11, 2016 12:34 am
by TopCoder
If testing succeeded and you receive the e-mail you can now set-up the second MX record with a higher priority (i.e. 20). When MX1 is offline, MX2 will receive the e-mails. When MX1 is back online, MX2 will send the emails to MX1.
Mail will go to the second one, if the first one gets too busy also. Doesn't have to be offline, if it doesn't respond the second one will be tried, before the sending MTA retries at a different time.