1 (edited by mikey 2020-04-02 00:40:13)

Topic: Running two or more iRedMail Servers

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.1 MARIADB edition
- Deployed with iRedMail Easy or the downloadable installer? downloadable
- Linux/BSD distribution name and version:  CentOS 7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

I am looking to run more then one iRedMail server all hosting the same accounts. This is being done to have fail-over protection.

Both servers will store all files in a mounted drive /datapoint that will be ruining on a fail-over NFS NAS.
Both servers will connect to the same remote fail-over protection MySQL database.

Would the best way of setting this up be.
1. Setup iRedMail as normal
2. Clone the server
3. Change the hostname of server 2
4. Pray it works....
haha

I know if I change any settings or files on server 1 that are not stored in /datapoint then I will need to re-clone or change the same settings or files on server 2.

What are your thoughts on this? any ideas are welcome.

DNS

@ MX 10 mx.g1.server1.com
@ MX 20 mx.g1.server2.com

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Running two or more iRedMail Servers

Completely wrong ...

3 (edited by mikey 2020-04-02 21:36:23)

Re: Running two or more iRedMail Servers

ZhangHuangbin wrote:

Completely wrong ...

Ok. Can I ask why this is the wrong way of doing it?


I was hoping my way may work. If not I was going to follow this setup.
https://docs.iredmail.org/haproxy.keepa … terfs.html

4

Re: Running two or more iRedMail Servers

mikey wrote:
ZhangHuangbin wrote:

Completely wrong ...

Ok. Can I ask why this is the wrong way of doing it?

I was hoping my way may work. If not I was going to follow this setup.
https://docs.iredmail.org/haproxy.keepa … terfs.html

The "Completely wrong ..." replay did not help me that much. Sorry
Does anyone have any reply?

Still would love to know why my way would not work. From what I can see if only one server is going to be used at once and one as a back up then there should not be any conflations.

Also is this the currant best way? > https://docs.iredmail.org/haproxy.keepa … terfs.html

5

Re: Running two or more iRedMail Servers

If you need a true/fully fail-over setup, here's some personal suggestion:

- you need fail-over softwares like pacemaker (and its dependent softwares like Corosync). https://clusterlabs.org/pacemaker/ Pacmaker + corosync (and more) will help you detect hardware/software failures and switch to another server automatically.
- Same mailbox can NOT be accessed from 2 (or more) servers at the same time, otherwise Dovecot index may be messed or even damaged. If you use mdbox mailbox format, damaged index files will cause message lose and not recoverable.
- Postfix queue directory should NOT be accessed by 2 servers at the same time.

Another semi-failover solution is master-slave setup LIKE this:

- setup iRedMail (same release) on both servers (let's call them server A and B)
- configure MySQL/OpenLDAP/PostgreSQL on server A to become master SQL/LDAP server
- configure MySQL/OpenLDAP/PostgreSQL on server B to become slave server and replicate data from server A
- configure Dovecot to perform 2-way mailbox sync with Dovecot Replication: https://wiki.dovecot.org/Replication Note: Dovecot supports 1-way (backup) or 2-way sync, it's replicated in real-time and not by cron job or regularly.
- Where there's a hardware/software failure, you decide whether or not to swap the master-slave setup and fix it on master server.

I'd like to ask one question: How many emails does your server receive and send per day? If not many, maybe a simple Linux + Postfix backup mx setup is better and easier?

If there're a lot emails per day, setup HAProxy + Heartbeat + a shared mailbox storage for load-balance cluster. We have a working setup deployed with Ansible in production, but a little out of date.

6

Re: Running two or more iRedMail Servers

ZhangHuangbin wrote:

If you need a true/fully fail-over setup, here's some personal suggestion:

- you need fail-over softwares like pacemaker (and its dependent softwares like Corosync). https://clusterlabs.org/pacemaker/ Pacmaker + corosync (and more) will help you detect hardware/software failures and switch to another server automatically.
- Same mailbox can NOT be accessed from 2 (or more) servers at the same time, otherwise Dovecot index may be messed or even damaged. If you use mdbox mailbox format, damaged index files will cause message lose and not recoverable.
- Postfix queue directory should NOT be accessed by 2 servers at the same time.

Another semi-failover solution is master-slave setup LIKE this:

- setup iRedMail (same release) on both servers (let's call them server A and B)
- configure MySQL/OpenLDAP/PostgreSQL on server A to become master SQL/LDAP server
- configure MySQL/OpenLDAP/PostgreSQL on server B to become slave server and replicate data from server A
- configure Dovecot to perform 2-way mailbox sync with Dovecot Replication: https://wiki.dovecot.org/Replication Note: Dovecot supports 1-way (backup) or 2-way sync, it's replicated in real-time and not by cron job or regularly.
- Where there's a hardware/software failure, you decide whether or not to swap the master-slave setup and fix it on master server.

I'd like to ask one question: How many emails does your server receive and send per day? If not many, maybe a simple Linux + Postfix backup mx setup is better and easier?

If there're a lot emails per day, setup HAProxy + Heartbeat + a shared mailbox storage for load-balance cluster. We have a working setup deployed with Ansible in production, but a little out of date.

Thank you for your replay.
At this time I am just playing with the idea.

Our current mail is about 3000 emails a day with 264 mail accounts.

I am currently setting up a Postfix MX backup.

@ MX 10 mx.g1.server1.com
@ MX 20 mx.g1.server2.com

If Server 1 is down or unreachable then mail will arrive at Server 2.
Server 2 will then try to connect to Server 1 to deliver the mail and if it fails the mail will stay in Server 2 mail queue.
When Server 1 is reachable new mail will arrive and the mail queued at Server 2 will start to be delivered to Server 1.

What I am trying to setup is if we have some downtime we don't loss any mail.

Thank You @ZhangHuangbin for your time.

7

Re: Running two or more iRedMail Servers

I'm asking a favor:

- Do you think it's necessary and useful if iRedMail Team offers backup mx servers / service and you (clients) just need to add one MX type DNS record for the mail domain? This way you don't need to setup and maintain your own backup mx server.
- Are you willing to pay a small monthly subscription fee for this backup mx service?

8 (edited by mikey 2020-04-08 17:15:46)

Re: Running two or more iRedMail Servers

ZhangHuangbin wrote:

I'm asking a favor:

- Do you think it's necessary and useful if iRedMail Team offers backup mx servers and you (clients) just need to add one MX type DNS record for the mail domain? This way you don't need to setup and maintain your own backup mx server.
- Are you willing to pay a small monthly subscription fee for this backup mx service?

Hello ZhangHuangbin

Thank you very much for the offer. I did not know you offered this service. I will keep this in mind.
At the moment I am just setting up a test environment and looking at the concept of using iRedMail.

If all goes well. I will be adding new mail domains first and see how that goes then moving current domains and accounts over. We run quite a lot of servers within out AWS infrastructure.

Have a coffee on me wink

9

Re: Running two or more iRedMail Servers

mikey wrote:

I did not know you offered this service.

We didn't. I'm doing some research. smile