# Best practice redundant offsite mail server

## petterg

What's the best practice for setting up an redundant mailserver offsite?

My earlier experience is singlehost qmail/courier and postfix/dovecot on single gentoo host. Now I'd like to setup two new servers so that one will be available even if network on one site goes down. What's the recommended way to do this?

----------

## jpc22

Clustering your machines could allow you to acheive redundancy with the right configuration, one node could take over if the other one fails or lose internet.

The only problem i see could be internet traffic cost.

----------

## petterg

If clustering can stick to just transfer changes written to disk, that would be ok. I imagine that would make one send out the same amount of data as it receives. (Receive 1MB mail = send 1MB of mail data to the other server.) If clustering makes significantly more data transfer, it will be a problem. Has anyone experience with offsite clustering?

Another way (as this will be mailserver only) I guess will be make sure the maildir directory is in sync between the machines. Or will that make some unexpected behavior?

----------

## jpc22

If you just want changes written to disk a clustered file system could do the trick and wont require going through all the clustering documentation.

----------

## petterg

I think changes to disk (data partition) should be good enough. Am I wrong?

What filesystem would be suited for this task? A requirement is that both servers should keep working as normal, even if the network between them goes down. And filesystem needs to sync once the network connection returns.

----------

## smartass

Perhaps Unison FS could suit your needs

----------

## petterg

Unison would be my last try. It's good at synchronizing directories once pr night, but it's not suited for discovering changes to a directory on the fly. The way it works is to make a checksum of every file. For every run it checks if any file is different from the last checksum. In a maildir there will be millions of files. Hence Unison will consume too much cpu to run in daytime.

Also maildir does a lot of mv-commands. Every time a imap connects, all files in folder new are moved to folder cur. Unison will see this as all files in new are deleted and the same files are created in cur, hence it will transfer them again. Then, when a file is marked as read, maildir marks with renaming the file, once again unison will see this as delete/create.

Unison is a great program. I use it a lot for backup, keeping laptop documents in sync with server. It made my life a lot easier. But it's not suited for maildir, outlook .pst files and database files.

----------

## cach0rr0

cyrus-imapd already has clustering support in and of itself

it's a bit of a hurdle to set up, but removes the need to worry about fs synchronization

this is probably the best route for seamless failover - too drunk to find links, but you should have an idea as to what to google

----------

## petterg

Thanks for that tip! I'll have a look at it

----------

