Topic: loadbalance iRedMail


I was thinking about load-balance for our email server, as pr today we are running only one mail server, but I will have 2 mail servers instead.

so one of the options is to setup a new server and configure MX record pri 20 for example because MX priority 10 is used for primary server.

But the question now is if the primary server fails and secondary is up and running for example 5 days what happen with emails which users received in their inbox when the primary server is coming up again ? how is this handled ?

Or is there a better way to load-balance it ?  what I am looking for is, we can run only one server but if that server fails than secondary server should take over... But the problem is how can we synchronize the users inbox later ?

any good suggestions ?

thank You


Re: loadbalance iRedMail

Think about below two major requirements of load balance:

*) How to sync mail accounts
*) How to sync mailboxes

If you can implement them perfectly, load balance should be easy to go.

Another way is setting up a new iRedMail server, restore mail accounts and mailboxes. Reference:

- How to migrate to new iRedMail server
  http://iredmail.org/wiki/index.php?titl … ail.Server


Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

3 (edited by OviVan 2012-03-04 20:08:54)

Re: loadbalance iRedMail

Hi Zhang,

thank You for reply.

*) How to sync mail accounts GOOD QUESTION
*) How to sync mailboxes      YET BETTER QUESTION

smile any idea how to accomplish this ?? suggestions ?

this would be very nice and very useful implementation within iRedMail...

Can You write a script that can do this job ? a "sync" script which have specified ip address of each server and once
the servers are up and running they should sync the emails and accounts every 5 sec for example... ?
it does not need to sync full each time but just the changes while one of the servers where down....

You can consider this as a suggestion as there is no such option in the iRedMail now as far as I know ...

Thank You


Re: loadbalance iRedMail

How to sync mail accounts

*) With OpenLDAP backend, you can simply setup OpenLDAP replication to sync
   data (includes all mail accounts) from master server.

1) http://www.openldap.org/doc/admin24/replication.html
2) http://www.zytrax.com/books/ldap/ch7/

*) With MySQL backend, you can setup MySQL replication to sync data (includes
   all mail accounts) from master server.

1) http://dev.mysql.com/doc/refman/5.0/en/replication.html

P.S. iRedMail provides shell scripts to backup LDAP/MySQL data with cronjob: iRedMail-x.y.z/tools/backup_*.sh.

How to sync mailboxes

*) With shared storage, there's no need to sync at all.
*) If you don't have shared storage, you may want to give DRBD a try: http://www.drbd.org/
   "DRBD can be understood as network based RAID-1."

You can easily setup Heartbeat + DRBD for fail-over or load-balance cluster.
There're many free documentations available if you search 'heartbeat drbd' with Google.

Also, if you stick at RHEL/CentOS platform, Red Hat Cluster Suite is a good choice.
You can also purchase commercial support from Red Hat. References:

- http://www.redhat.com/products/enterpri … ilability/
- http://docs.redhat.com/docs/en-US/Red_H … index.html


Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee


Re: loadbalance iRedMail

Hi again Zhang,

thank You for nice and detailed explanation.
I will read trough all of the options You mentioned and see what will be the best choice in my case...