我在 Ubuntu 18.04.1 上安装了 dovecot v2.2.33.2。我已按照通常为 HA 服务器配置的方式配置了 Dovecot 复制器,但出于某种原因,它不会将进入 mx1 的新电子邮件同步到 mx2。如果我在 mx1 上打开电子邮件并阅读,它会同步到 mx2。或者如果我删除它,情况也一样。
如果我在 mx2 上写了一封新电子邮件并发送,它会立即同步到 mx1。
就像 mx1 没有向 mx2 发送新电子邮件的新通知,但是一旦我打开电子邮件,同步就可以正常工作。
我已经设置了几次复制,从来没有遇到过这个问题,不确定问题出在哪里。
mx1 和 2 上的配置相同,当然除了各自的 IP 指向对方之外。
文件如下dovecot.conf
:
listen = *,[::]
protocols = imap pop3
auth_mechanisms = plain login
disable_plaintext_auth = no
log_timestamp = "%Y-%m-%d %H:%M:%S "
mail_privileged_group = vmail
postmaster_address = [email protected]
ssl_cert = </etc/postfix/smtpd.cert
ssl_key = </etc/postfix/smtpd.key
ssl_protocols = !SSLv3
mail_max_userip_connections = 100
passdb {
args = /etc/dovecot/dovecot-sql.conf
driver = sql
}
userdb {
driver = prefetch
}
userdb {
args = /etc/dovecot/dovecot-sql.conf
driver = sql
}
plugin {
quota = dict:user::file:/var/vmail/%d/%n/.quotausage
sieve=/var/vmail/%d/%n/.sieve
sieve_max_redirects = 25
}
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0660
user = postfix
}
unix_listener auth-userdb {
group = vmail
mode = 0600
user = vmail
}
user = root
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
service imap-login {
client_limit = 1000
process_limit = 512
}
protocol imap {
mail_plugins = quota imap_quota
}
protocol pop3 {
pop3_uidl_format = %08Xu%08Xv
mail_plugins = quota
}
protocol lda {
postmaster_address = [email protected]
mail_plugins = sieve quota
}
protocol lmtp {
postmaster_address = [email protected]
mail_plugins = quota sieve
}
mail_plugins = $mail_plugins quota
# Enable the replication plugin globally
mail_plugins = $mail_plugins notify replication quota
# Both the client and the server need to have a shared secret
doveadm_password = pass_word
# configure how many dsyncs can be run in parallel (10 by default)
replication_max_conns = 10
service aggregator {
fifo_listener replication-notify-fifo {
user = vmail
mode = 0666
}
unix_listener replication-notify {
user = vmail
mode = 0666
}
}
service replicator {
unix_listener replicator-doveadm {
mode = 0666
}
}
service doveadm {
user = vmail
inet_listener {
port = 4711
}
}
service config {
unix_listener config {
user = vmail
}
}
# use tcp:ip as the dsync target
plugin {
replication_full_sync_interval = 1 hours
mail_replica = tcp:0.0.0.0:4711
}
protocol imap {
mail_plugins = quota imap_quota notify replication
}
此外,如果我运行doveadm replicator replicate '*'
强制复制,它会立即将待处理的电子邮件发送到 mx2。但如果没有它,它就不会。在我的测试期间,我让它自动向 mx2 发送一次,大约需要 20 分钟。
从那时起,它就没再自动执行过。状态显示上次同步时间一直在增加,除非我强制执行或打开电子邮件,否则它不会回到零。
答案1
您忘记了协议块中的插件:
protocol imap {
mail_plugins = notify replication quota imap_quota
}
protocol pop3 {
pop3_uidl_format = %08Xu%08Xv
mail_plugins = notify replication quota
}
添加它们后,您的邮箱发生变化后,它会显示在复制状态中:
# doveadm replicator status '*'
username priority fast sync full sync success sync failed
[email protected] none 00:00:03 00:33:57 00:00:03 -