Arnaud Abélard
2022-May-13  20:26 UTC
how is the "Total number of known users" reported by doveadm replicator calculted?
Hello, I have a question regarding the "Total number of known users" displayed by doveadm replicator status. How is it calculated? Shouldn't it match the number of users reported by doveadm user '*' ? I have 3 servers being replicated, the "total number of known users" a lot higher than the number of users reports by doveadm user '*' why is that? Arnaud -- Arnaud Ab?lard Responsable Service Infrastructures DSIN Universit? de Nantes - -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4186 bytes Desc: S/MIME Cryptographic Signature URL: <https://dovecot.org/pipermail/dovecot/attachments/20220513/12ec6a3b/attachment.bin>
Paul Kudla (SCOM.CA Internet Services Inc.)
2022-May-13  21:14 UTC
how is the "Total number of known users" reported by doveadm replicator calculted?
ok assuming that you are using a database for virtual users
(this is pgsql)
# cat dovecot-pgsql.conf
driver = pgsql
connect = host=localhost port=5433 dbname=scom_billing user=pgsql 
password=xxxxxxxxx
default_pass_scheme = PLAIN
password_query = SELECT username as user, password FROM email_users 
WHERE username = '%u' and password <> 'alias' and status =
True and
destination = '%u'
user_query = SELECT home, uid, gid FROM email_users WHERE username = 
'%u' and password <> 'alias' and status = True and
destination = '%u'
iterate_query = SELECT "username" as user, domain FROM email_users
WHERE
status = True and alias_flag = False
iterate_query controls what is returned to doveadm user '*' and the 
replication service.
in the above example i only return active accounts and skip alias 
accounts (fyi)
adjust to your config.
if it is not setup propoerly then both functions will return bad info to 
the replicator
if the replicator picks up on a new user on its own it will add it to 
its own replicator db (see example below) - this is why you are getting 
different result count wise.
once the .db file is updated it will carry that user till re-created 
(see below)
to sync this you need to shut down all servers.
origionaly before i figured this out i had to delete the .db file on all 
servers, touch it (aka make a blank file) and then restart the servers
dovecot will set the rights automatically when you start it up again
best sugestion is the get the doveadm user '*' working first as it will 
be the base results.
see :
[17:05:03] mail18.scom.ca [root:0] /usr/local/var/lib/dovecot
# ll
total 86
drwxr-xr-x  2 root  wheel  uarch    4B May 13 10:52 .
drwxr-xr-x  4 root  wheel  uarch    4B Mar  8  2021 ..
-rw-r--r--  1 root  wheel  uarch   73B May 13 10:52 instances
-rw-r--r--  1 root  wheel  uarch  161K May 13 16:50 replicator.db
replicator.db is a txt file that carries the current status of the 
replication service.
example entry (carries hash info etc that tells the replicator service 
what happens next - ie when to pull a sync) :
ditchburn at scom.ca       0       1651914641      1652433042 
1652433042      0 
AQAAALiUhhMjOhJiUHwAAM9Y3P8lOhJiAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAJ8pBLXM8EmKfkQAAz1jc/yc6EmIEAAAABgAAAAAAAAAAAAAAAAAAAAQAAABI1pY73z0SYp+RAADPWNz/KjoSYgAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAJLdYwEjOhJiFCEBANHccmUlOhJiAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAoEK+EyM6EmJQfAAAz1jc/yY6EmIAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAA9flMZFfIUYr7FAADR3HJlLDoSYgAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAEZJQhMjOhJiUHwAAM9Y3P8jOhJiAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAkErEKRnyFGK+xQAA0dxyZS06EmIAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAACYRnsA4D0SYp+RAADPWNz/KzoSYgAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAHiN8xV7PBJin5EAAM9Y3P8oOhJiTQAAAFAAAAAAAAAAAAAAAAAAAABNAAAASIGABsI9EmKfkQAAz1jc/yk6EmIWAAAAGAAAAAAAAAAAAAAAAAAAABYAAABX2T8x
    1652433042
this db file generates the user.sync status etc
doveadm replicator status '*'
Happy Friday !!!
Thanks - paul
Paul Kudla
Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3
Toronto 416.642.7266
Main?1.866.411.7266
Fax?1.888.892.7266
On 5/13/2022 4:26 PM, Arnaud Ab?lard wrote:> Hello,
> 
> I have a question regarding the "Total number of known users"
displayed
> by doveadm replicator status. How is it calculated? Shouldn't it match 
> the number of users reported by doveadm user '*' ?
> 
> I have 3 servers being replicated, the "total number of known
users" a
> lot higher than the number of users reports by doveadm user '*' why
is
> that?
> 
> Arnaud
> 
>