Replication: "cross-updates" of mail meta-data

Andre Nathan andre at digirati.com.br
Thu Jun 11 14:19:45 UTC 2015


Hello

I have a two-server dovecot setup using replication. Each server runs
two dovecot instances, one for director and another for the backend.
Initially I set up a single server, got it all working, then rsync'd the
data and index partitions to the new one and started the clusters (I
used rsync as a way to speed-up dovecot's initial replication). Both
servers listen on a virtual IP addresses load-balanced by IPVS as well
as their own IP addresses.

When I started dovecot in the second server, users started reporting
that some of their messages were missing. I noticed that while the mail
data seemed to be up to date in server1, it wasn't in server2; however,
the indexes were being updated in server2 but not in server1. For
example, "doveadm quota get -u some-user" would report the wrong value
in server1 and the right value in server2, while a "du" would show that
only server1 actually had the most up-to-date data.

At the moment I had to take down server2, because as soon as dovecot is
running in it, users start reporting missing messages again. To solve
that problem, a "doveadm force-resync" in server1 isn't enough. I either
rsync the index files from server2 or remove the indexes in server1
before the force-resync, which then works.

Has anyone ever saw anything similar to this? Any help would be much
appreciated.

I'm running Ubuntu 14.04 with dovecot 2.2.15 with the configurations below:

=== Backend instance ===

# dovecot -n
# 2.2.15: /etc/dovecot/dovecot.conf
# OS: Linux 3.16.0-37-generic x86_64 Ubuntu 14.04.2 LTS
auth_master_user_separator = *
auth_mechanisms = plain login
auth_username_chars =
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@=
auth_worker_max_count = 10
disable_plaintext_auth = no
doveadm_password = secret
doveadm_port = 12345
listen = server1.mydomain.com
mail_fsync = never
mail_gid = dovemail
mail_plugins = " notify replication quota"
mail_uid = dovemail
managesieve_sieve_capability = fileinto reject envelope vacation
subaddress comparator-i;ascii-numeric relational regex copy include
vacation-seconds imapflags notify
namespace {
  inbox = yes
  location =
  mailbox SPAM {
    auto = subscribe
  }
  prefix =
  separator = /
  type = private
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
passdb {
  args = /etc/dovecot/dovecot-sql-master.conf.ext
  driver = sql
  master = yes
  pass = yes
}
plugin {
  mail_replica = tcp:192.168.0.2:12345 # server2's replication IP
  quota = dict:User
quota::file:/var/lib/imap/user/%2.256RHn/%n/dovecot-quota
  quota_rule = *:storage=1GB
  sieve = /var/lib/imap/sieve/%2.256RHn/%n/dovecot.sieve
  sieve_dir = /var/lib/imap/sieve/%2.256RHn/%n
  sieve_extensions = comparator-i;ascii-numeric copy envelope fileinto
imapflags include notify regex reject relational subaddress vacation-seconds
  sieve_max_redirects = 20
  sieve_max_script_size = 512KB
  sieve_quota_max_scripts = 2
  sieve_vacation_min_period = 1
  sieve_vacation_send_from_recipient = yes
}
protocols = imap pop3 lmtp sieve
replication_dsync_parameters = -f -d -N -l 30 -U
service aggregator {
  fifo_listener replication-notify-fifo {
    group = dovemail
    mode = 0666
    user = dovemail
  }
  unix_listener replication-notify {
    group = dovemail
    mode = 0666
    user = dovemail
  }
}
service auth-worker {
  user = $default_internal_user
}
service auth {
  client_limit = 10240
  process_limit = 1
  process_min_avail = 1
}
service doveadm {
  inet_listener {
    address = 192.168.0.1
    port = 12345
  }
  vsz_limit = 1 G
}
service imap {
  process_limit = 8192
  process_min_avail = 10
}
service lmtp {
  inet_listener {
    address = lmtpcluster.internal.mydomain.com,
server1.internal.mydomain.com
    port = 1124
  }
  process_limit = 512
  process_min_avail = 10
}
service managesieve-login {
  inet_listener sieve {
    address = lmtpcluster.internal.mydomain.com,
server1.internal.mydomain.com
    port = 4190
  }
}
service managesieve {
  process_limit = 20
  process_min_avail = 10
}
service pop3 {
  process_limit = 512
  process_min_avail = 10
}
service replicator {
  process_min_avail = 1
  unix_listener replicator-doveadm {
    group = dovemail
    mode = 0666
    user = dovemail
  }
}
ssl_cert = </etc/ssl/certs/mydomain.crt
ssl_key = </etc/ssl/private/mydomain.key
userdb {
  driver = prefetch
}
userdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
verbose_proctitle = yes
protocol imap {
  imap_client_workarounds = tb-extra-mailbox-sep delay-newmail
  imap_idle_notify_interval = 2 mins
  imap_max_line_length = 64 k
  mail_max_userip_connections = 50
  mail_plugins = " notify replication quota imap_quota"
}
protocol lmtp {
  info_log_path = /var/log/mail/dovecot-lmtp.log
  mail_fsync = optimized
  mail_plugins = " notify replication sieve quota"
}
protocol sieve {
  mail_plugins = " notify replication sieve"
  managesieve_implementation_string = ManageSieve
  managesieve_logout_format = bytes=%i/%o
  managesieve_max_line_length = 65536
  managesieve_sieve_capability = comparator-i;ascii-numeric copy
envelope fileinto imapflags include notify regex reject relational
subaddress vacation-seconds
  ssl = no
}
protocol pop3 {
  mail_plugins = " notify replication quota"
  pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
}

=== Director instance ===

# dovecot -n -c /etc/dovecot_director/dovecot_director.conf
# 2.2.15: /etc/dovecot_director/dovecot_director.conf
# OS: Linux 3.16.0-37-generic x86_64 Ubuntu 14.04.2 LTS
auth_master_user_separator = *
auth_mechanisms = plain login
auth_username_chars =
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@=
auth_worker_max_count = 10
base_dir = /var/run/dovecot_director
director_mail_servers = server1.internal.mydomain.com
server2.internal.mydomain.com
director_servers = A.B.C.1 A.B.C.2 # server1 and server2 external IP
addresses
disable_plaintext_auth = no
instance_name = dovecot_director
listen = lmtpcluster.mydomain.com, server1.mydomain.com
lmtp_proxy = yes
login_greeting = IMAP/POP3 server
mail_fsync = never
mail_gid = dovemail
mail_plugins = " quota"
mail_uid = dovemail
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope
encoded-character vacation subaddress comparator-i;ascii-numeric
relational regex imap4flags copy include variables body enotify
environment mailbox date ihave
passdb {
  args = /etc/dovecot_director/dovecot_director-sql.conf.ext
  driver = sql
}
passdb {
  args = /etc/dovecot_director/dovecot_director-sql-master.conf.ext
  driver = sql
  master = yes
  pass = yes
}
protocols = imap pop3 lmtp
service auth-worker {
  user = $default_internal_user
}
service auth {
  client_limit = 10240
  process_limit = 1
  process_min_avail = 1
}
service director {
  fifo_listener login/proxy-notify {
    mode = 0666
  }
  inet_listener {
    address = A.B.C.1
    port = 7777
  }
  unix_listener director-userdb {
    mode = 0600
  }
  unix_listener login/director {
    mode = 0666
  }
}
service imap-login {
  executable = imap-login director
  idle_kill = 10 secs
  inet_listener imap {
    port = 143
  }
  process_limit = 400
  process_min_avail = 10
  service_count = 0
  vsz_limit = 512 M
}
service lmtp {
  inet_listener lmtp {
    address = lmtpcluster.internal.mydomain.com,
server1.internal.mydomain.com
    port = 24
  }
  process_limit = 512
}
service pop3-login {
  executable = pop3-login director
  idle_kill = 10 secs
  inet_listener pop3 {
    port = 110
  }
  process_limit = 256
}
ssl_cert = </etc/ssl/certs/mydomain.crt
ssl_key = </etc/ssl/private/mydomain.key
userdb {
  driver = prefetch
}
userdb {
  args = /etc/dovecot_director/dovecot_director-sql.conf.ext
  driver = sql
}
verbose_proctitle = yes
protocol lmtp {
  auth_socket_path = director-userdb
  info_log_path = /var/log/mail/dovecot-director-lmtp.log
  passdb {
    args = proxy=y nopassword=y port=1124
    driver = static
    name =
  }
}

Thanks in advance,
Andre

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <http://dovecot.org/pipermail/dovecot/attachments/20150611/4ab78beb/attachment.sig>


More information about the dovecot mailing list