Replication: does it work in both directions?

Bron Gondwana brong at
Mon Nov 12 09:26:06 EST 2007

On Sun, Nov 11, 2007 at 08:41:04PM -0800, Rich Wales wrote:
> Earlier, I wrote:
> >> What do I need to do in order for changes made on the replica
> >> to get copied over to the master?
> Bron Gondwana replied:
> > Impossible.  You don't do this.  What you can do (the simple
> > case of what we do) is set up two Cyrus instances on each
> > machine, replicating to each other, and set up user accounts
> > on one or the other, so you can get full use of both machines.
> I note that sync_client can take a list of mailboxes on the command
> line.  Does this define (and limit) the set of mailboxes that are
> replicated?  If a mailbox is listed in the command line, are sub-
> mailboxes replicated too?

It doesn't work like that.  Rolling replication gets events from
actions on mailboxes (lmtp deliver, imapd updates, etc) and logs
them - then the sync_client process running in the background
reads that log file and uses the actions to know what things to
check and sync with the sync_server on your replica.

> My environment (family network) only has half a dozen users, and the
> set of users changes only rarely.  Suppose I do the following:
> (1) I divide my users into two groups -- each group assigned to one
>     of my two Cyrus servers as the master for those users.
> (2) The sync_client line in cyrus.conf for each server lists the
>     mailboxes for the users assigned to that server as master.  Each
>     user is listed in the sync_client command line of only one server.
> (3) Each server is configured (via the sync_... lines in imapd.conf)
>     to sync to the other server.
> (4) Both servers would be running sync_server.
> So, I would have replication set up going both directions between my
> two servers, but the sets of users handled in each direction would be
> disjoint.  Each user would be assigned to one IMAP server (the master
> for their mailbox collection), and the other server would be their
> replica and act as their backup.
> Would this work?

You are evil.  While I can't see any particular reason why it wouldn't,
I'm still scared.  I wouldn't be game to mess with that.  You'd really
REALLY want to be sure that your email delivery and IMAP connections
only happened to the approved master for each user or you'd get a bad
case of split brain.
> Remember, again, that I'm talking about a small installation.  Clearly,
> a scheme requiring every user's mailbox to be explicitly listed in one
> or the other server's sync_client line is not going to scale to a large
> setup with hundreds or thousands of users; I understand this.
> If this idea of doing two-way partial replication with a single Cyrus
> instance on each server will in fact work, should I use the same value
> for sync_machineid on both servers?  Or should they be different?

If you use use 2.3.10 then it really doesn't matter at all.  It's a
relic of worser UUIDs (now sha1 based GUIDs) that nobody wants to
talk about ever again.  That said, the code probably still requires
you set it, and I'd set them differently just for the "why not"
factor.  Maybe something deep in the code still cares and I can't
be arsed checking right now, I've been reading the skiplist code
for days, and I'm sure it will give me nightmares when I calm down
enough to sleep!


More information about the Info-cyrus mailing list