[Dovecot] dsync and active-active fault tolerance mail servers
I would like to set up an active-active fault tolerance couple of mail servers.
Is the following procedure correct?
Let's suppose I want to set up two servers for acme.com, mail1.acme.com and mail2.acme.com
I declare both servers as MX in DNS configuration.
Mailbox are stored in maildir with a single UID/GID owner for all the maildir files
Userbase is MySQL, user tables are replicated using MySQL tools; in this case, the replica is one way, that is mail1.acme.com holds the "master" copy of MySQL tables and mail2.acme.com hold the "copy".
The replica is done via dsync with a procedure like this executed on mail1.acme.com server:
foreach mailbox { dsync mirror mailbox }
Where mailbox is the full mail address, used also as a login name for authentication.
My goal is to allow users to connect the mail servers they like and have all their mail (a 10/15 minute of sync delay is acceptable).
This is the theory, now some questions.
Use Linux user/group owner of the files and directories are the same on both hosts (they are both foobar), but have different numeric ID, in one host foobat has UID 1234 and on the other host foobar has UID 2345. Is this an issue?
Mail location path is the same on both hosts, but where does dsync get it? Does dsync get all the information from the userbase defined in dovecot.conf (and other included files)?
Have I to scan the entire userbase and execute dsync for each user, or is there a trick to do for every user with a single command?
How often is good to run the synchronization? 5 minutes? 10? 15?
What is the correct command line to invoke dsync in this scenario?
Does anyone else tried this? :)
Thank you.
Ciao, luigi
-- / +--[Luigi Rosa]-- \
(1) Everything depends. (2) Nothing is always. (3) Everything is sometimes.
On 21.8.2010, at 9.05, Luigi Rosa wrote:
The replica is done via dsync with a procedure like this executed on mail1.acme.com server:
foreach mailbox { dsync mirror mailbox }
- Use Linux user/group owner of the files and directories are the same on both hosts (they are both foobar), but have different numeric ID, in one host foobat has UID 1234 and on the other host foobar has UID 2345. Is this an issue?
No. Just don't have your userdb specify the UID as a number (or at all, just set a global mail_uid = foobar in config file).
- Mail location path is the same on both hosts, but where does dsync get it? Does dsync get all the information from the userbase defined in dovecot.conf (and other included files)?
dsync reads the config the same way all other standalone programs (including dovecot master) do it: it executes doveconf, which parses the config. Then if you give -u parameter to dsync it also does userdb lookup from auth process.
- Have I to scan the entire userbase and execute dsync for each user, or is there a trick to do for every user with a single command?
Currently you need to execute dsync separately for each user. It's also more reliable since I think there are still some rare random crashes in dsync. If you find these, let me know and I'll try to fix them. :) Also you should probably be running a few dsyncs in parallel to finish the sync in less time.
- How often is good to run the synchronization? 5 minutes? 10? 15?
Dunno. But see http://dovecot.org/list/dovecot/2010-August/051714.html
- What is the correct command line to invoke dsync in this scenario?
Maybe simply: dsync mirror -u user@domain mail2.acme.com
Timo Sirainen said the following on 21/08/2010 14.54:
Maybe simply: dsync mirror -u user@domain mail2.acme.com
Timo, thank you for all your answers. I will set up a replicated active-active configuration in the following weeks and I will let you know if problems arise.
Ciao, luigi
-- / +--[Luigi Rosa]-- \
I'm glad I was not born before tea. --Sidney Smith (1771-1845)
participants (2)
-
Luigi Rosa
-
Timo Sirainen