replication questions - best practice?

Bron Gondwana brong at fastmail.fm
Wed Feb 19 16:01:17 EST 2014


On Thu, Feb 20, 2014, at 03:01 AM, Marcus Schopen wrote:
> I'm running a single standalone master and a replica slave. What is best
> failover practice for this setup? How do I make a replication slave to
> master if the standalone master is down? Just remove syncserver from
> SERVICE section on slave and restart it (and update DNS record and
> change certificates)?

That's pretty much what we do.  We do shut down the master, then use
sync_client to run any leftover log files before switching ends.

I wouldn't bother removing sync_server from the config, it doesn't hurt.
The only bit that needs changing for sure is which end sync_client runs
from.

> If the former standalone master is up again how do I sync the slave,
> which is temporary master now, fully back to the former master? Just put
> a syncserver enty to SERVICES section on the former master and
> syncclient to START section on the temporary master and restart both
> server?

Pretty much.  You need to change the routing somehow so that clients know
who is the new master.  We used to do this with IP address failover
(from linux-ha), but now we use more complex database-based routing system
to allow us to move masters to different datacentres.

> And how do I force a full sync back, just restart master and slave?

That doesn't do a full sync - there's no good full-sync tool built into
Cyrus.  We use something which runs sync_client -u on each user on the
server, which is not ideal.

> Is there there a good howto for replication, e.g. tuning, fixing common
> problems? The howto on 
> 
> http://cyrusimap.web.cmu.edu/docs/cyrus-imapd/2.4.15/install-replication.php
> 
> works fine, but is very basic (in my case I had to add "sync_port:
> csync" to imap.conf to get it working. Getting TLS to run between master
> and slave took me two nights and two red wine bottles. ;)

Documentation is our major weakness :(

> What tools are best to check if master and replica are in full sync?
> Just logfiles?

I've posted a perl module to this list a few times, it will be in the
archive.  It logs on with IMAP at each end and compares a pile of things
which should be the same.

> Last question: Is it a no go to connect with an imap client on the slave
> to check if sync is working as long as the slave is not becoming master?

It's perfectly safe to use an IMAP client at each end.  I would use EXAMINE
rather than SELECT, but even SELECT should be fine if you don't mess around.

The replication engine is fairly good at fixing even when you do change things
on the replica - next time that mailbox gets changed on the master it will
notice that both ends have had changes, and do a full sync - which is pretty
good at merging the changes.  It's not perfect though.  Main failure points are
delete vs create of mailboxes, annotations, sieve, subscriptions... the things
which aren't just messages within mailboxes.  Those other things don't have
MODSEQ or deletion records.

Cheers,

Bron.
-- 
  Bron Gondwana
  brong at fastmail.fm


More information about the Info-cyrus mailing list