Re: Replication: does it work in both directions?

2007-11-13 Thread David Carter
On Sun, 11 Nov 2007, Rich Wales wrote:

 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.

We do this. It is quite useful to be able to bounce users back and forth 
between the two machines in a pair so that servers can be maintained 
(patches, O/S upgrades, whatever) without any user visible downtime.

Three caveats:

1) It won't work with shared mailboxes.

2) I'm not running the same replication code as the rest of you (though
replication in 2.3 is based on an old version of my code). I seem to
remember Ken raising an objection when this last discussed a year or
two back now. The objection may just have just been (1).

3) Sanity checks are good:

USER dpc22
NO IMAP_INVALID_USER Attempt to update master for dpc22

-- 
David Carter Email: [EMAIL PROTECTED]
University Computing Service,Phone: (01223) 334502
New Museums Site, Pembroke Street,   Fax:   (01223) 334679
Cambridge UK. CB2 3QH.

Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: Replication: does it work in both directions?

2007-11-12 Thread Rudy Gevaert
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?

No

 
 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?
 
 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.

A first problem is that normally sync_client is started with -r (rolling 
mode) in the start section of cyrus.conf.  Running sync_client -u 
wouldn't work because sync_client isn't started as a daemon.

You could try to put the sync_client -u lines in the event section of 
cyrus.conf.  If you then set the period rather small, you nearly have 
synchronous replication.


 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?

I wouldn't know.


-- 
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Rudy Gevaert  [EMAIL PROTECTED]  tel:+32 9 264 4734
Directie ICT, afd. Infrastructuur ICT Department, Infrastructure office
Groep SystemenSystems group
Universiteit Gent Ghent University
Krijgslaan 281, gebouw S9, 9000 Gent, Belgie   www.UGent.be
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: Replication: does it work in both directions?

2007-11-12 Thread Bron Gondwana
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!

Bron.

Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: Replication: does it work in both directions?

2007-11-12 Thread Rich Wales
Bron Gondwana wrote:

 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.

OK, that's the answer I needed to hear.  If a mailbox list on the
command line is not compatible with rolling replication, then I'll
simply not have a choice but to set up two Cyrus instances if I
want to spread my users across different IMAP servers.

-- 
Rich Wales  ===  Palo Alto, CA, USA  === [EMAIL PROTECTED]
http://www.richw.org   ===   http://en.wikipedia.org/wiki/User:Richwales
The difference between theory and practice is that, in theory,
theory and practice are identical -- whereas in practice, they aren't.

Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: Replication: does it work in both directions?

2007-11-12 Thread Bron Gondwana

On Mon, 12 Nov 2007 09:37:12 -0800, Rich Wales [EMAIL PROTECTED] said:
 Bron Gondwana wrote:
 
  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.
 
 OK, that's the answer I needed to hear.  If a mailbox list on the
 command line is not compatible with rolling replication, then I'll
 simply not have a choice but to set up two Cyrus instances if I
 want to spread my users across different IMAP servers.

It works fine as a one-off, but not for rolling, because rolling reads
the log.

That said, only users who have had any actions on that server will
create log entries.

I am quite tempted to test your theoretical layout at some point, but
right now I'm heartily sick of playing with Cyrus and am going to take
a break and do something totally different.

Bron.
-- 
  Bron Gondwana
  [EMAIL PROTECTED]


Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: Replication: does it work in both directions?

2007-11-12 Thread Rich Wales
Bron Gondwana wrote:

 [A mailbox list on the sync_client command line] works fine as a
 one-off, but not for rolling, because rolling reads the log.

Understood.

 That said, only users who have had any actions on that server will
 create log entries.

Interesting.  This actually suggests that I might be able to get away
with setting up two Cyrus servers to replicate to each other (i.e.,
each server would play master and treat the other as its replica) --
as long as all activity for any one given user takes place on just
one of the servers.

This requirement might well be impossible to meet in an environment
with shared mailboxes . . . but I don't have any shared mailboxes in
my setup, so I shouldn't need to worry about that.

All activity for any one given user would presumably have to include
initial delivery -- i.e., I would have to configure my Postfix to send
each user's mail to be delivered on the Cyrus server where he/she will
be reading his/her mail.  But I can do that.

-- 
Rich Wales  ===  Palo Alto, CA, USA  === [EMAIL PROTECTED]
http://www.richw.org   ===   http://en.wikipedia.org/wiki/User:Richwales
The difference between theory and practice is that, in theory,
theory and practice are identical -- whereas in practice, they aren't.

Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: Replication: does it work in both directions?

2007-11-11 Thread Bron Gondwana
On Sat, Nov 10, 2007 at 07:51:15PM -0800, Rich Wales wrote:
 I'm using replication on a 2.3.9 system.
 
 I know that if changes happen on the master system, they are propagated
 automatically to the replica system.
 
 But what happens if I make a change on the replica (e.g., by setting up
 an account to access its mail through the replica's IMAP server)?  I
 tried this just now, and the change is NOT propagating from the replica
 to the master.
 
 What do I need to do in order for changes made on the replica to get
 copied over to the master?  Or is this simply impossible?

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.

Regards,

Bron.

Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: Replication: does it work in both directions?

2007-11-11 Thread Rich Wales
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?

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?

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?

-- 
Rich Wales  ===  Palo Alto, CA, USA  === [EMAIL PROTECTED]
http://www.richw.org   ===   http://en.wikipedia.org/wiki/User:Richwales
The difference between theory and practice is that, in theory,
theory and practice are identical -- whereas in practice, they aren't.

Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html