Master-Master replication question

Rick Romero rick at havokmon.com
Mon Jul 11 15:36:13 UTC 2016


  Quoting "William L. Thomson Jr." <wlt-ml at o-sinc.com>:

> You are not alone!
>
> On Wednesday, July 06, 2016 01:15:34 PM Remko Lodder wrote:
>> Dear list,
>>
>> I have setup a master-master replication setup. My primairy MX's send
>> email
>> over on a DNS loadbalanced way, so DNS is doing some kind of round-robin
>> way of sending mail to both master servers.
>>
>> I found out, that on one of the two machines, the email synchronisation
>> is
>> heavily delayed. Lets assume server A receives a mail from the MX; it
>> synchronises almost instantly with the other server.
>>
>> Whenever server B receives the email, it could take up to several hours
>> to
>> synchronise the email, it seems that it is not detected prior.
>
> I have been dealing with this for months.
> http://www.dovecot.org/list/dovecot/2016-March/103680.html
>
> For a band aid I use  this crontab entry. On the 2nd mail server.
>
> */15 * * * *   root    /usr/bin/doveadm sync -u "*" remote:mail1
> <snip>

Are you guys using LMTP to deliver from your MX server to the mailbox
server?

I have a similar setup, but not yet synched, because as I understand it -
using 'deliver' to drop mail into an NFS mount won't inititate a sync.  I
have to migrate my procmail scripts to sieve (and use the execute plugin)
and change my final delivery to be a redirect to LMTP.   Not sure how
replication will work when running old procmail scripts from sieve...

In any case..  If you're piping to dovecot's deliver/dovecot-lda, here is
a rudimentary LMTP script I hacked together that I planned to use to
replace deliver with...   I'd grab the 'master' mailbox server IP for
each user for the command line.

#!/usr/bin/perl

use Net::LMTP;
use Getopt::Std;

$opts{'s'} = "localhost";
$opts{'p'} = "24";
$opts{'f'} = 'root@' . `hostname`;
chomp($opts{'f'});
chomp($opts{'s'});
getopts("hs:p:f:u:", \%opts);

if ($opts{'h'}) {
    print "
lmtpsend [-s lmtpserver] [-f fromaddress] [-u subject] toaddress [...]

  lmtpsend will send an email from the commandline.

  Options:
    -s lmtpserver      Sets the lmtpserver for where to send the
mail through.
    -f fromaddress     Sets the email address to be used on the
From: line.
    -u subject         Sets the email subject to be used from
the Subject line.
    toaddress          Where you want the email sent to.

";
    exit;
}

die "no recepients to send mail to" if ($#ARGV < 0);

@emailbody = <STDIN> ;

# send the message

$message = Net::LMTP->new($opts{'s'},$opts{'p'}) || die "can't talk to
server $opts{'s'}\n";

$message->mail($opts{'f'});
$message->to(@ARGV) || die "failed to send to the recepients
",join(",", at ARGV),": $!";
$message->data();
$message->datasend("To: " . join(", ", at ARGV) . "\n");
$message->datasend(@emailbody);
$message->dataend();
$message->quit;

Rick


More information about the dovecot mailing list