<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>I'm trying to get some more confidence as to whether replication is actually working properly and whether I'm not missing anything that will burn me if I ever have to 'fallback'. Has anyone ever done some verification outside of simply watching doveadm replication stats, to see if they are missing anything ?</div><div></div></div></blockquote><div><br></div><div>For anyone who needs this in the future, the approach I came up with was to count messages and compare sizes for each account. Won't protect me against data corruption but gives me reasonable confidence that the sync is working.</div><div><br></div><div>Two server scripts:</div><div><br></div><div>list-users.sh:</div><div><br></div><div><font face="monospace">#!/bin/bash</font></div><div><font face="monospace">doveadm user "*"<br></font></div><div><br></div><div>get-mailbox-hashes.sh:</div><div><br></div><div><font face="monospace">#!/bin/bash<br></font></div><div><font face="monospace">while read account; do<br>  echo "$account $(doveadm -f flow fetch -u "$account" "mailbox-guid uid size.virtual" ALL|sort|md5sum)"<br>done<br></font></div><div><br></div><div><br></div><div>and a script that drives this, looping until the list of differing accounts is back to 0</div><div><br></div><font face="monospace">#!/bin/bash<br>PRIMARY=$1<br>FALLBACK=$2<br><br>echo "$(date +%H:%M:%S) Requesting initial userlist"<br><br>ssh $PRIMARY /opt/container/list-users.sh | sort | tee /tmp/initialuserlist > /tmp/userlist<br>while true; do<br>  NUMENTRIES=$(echo $(cat /tmp/userlist|wc -l))<br>  echo "$(date +%H:%M:%S) Userlist is now $NUMENTRIES entries long (see /tmp/userlist)"<br><br>  if [ "$NUMENTRIES" == "0" ]; then<br>    echo "$(date +%H:%M:%S) DONE! All are (finally?) in sync"<br>    exit 0<br>  fi<br><br>  echo "$(date +%H:%M:%S) Hashing users..."<br>  cat /tmp/userlist | ssh $PRIMARY /opt/container/get-mailbox-hashes.sh | sort > /tmp/accounthashes-primary &<br>  cat /tmp/userlist | ssh $FALLBACK /opt/container/get-mailbox-hashes.sh | sort > /tmp/accounthashes-fallback &<br><br>  wait %1 %2<br>  echo "$(date +%H:%M:%S) Comparing users..."<br>  comm -3 /tmp/accounthashes-primary /tmp/accounthashes-fallback|sed -e 's/^\t*//'|cut -d' ' -f1|sort -u> /tmp/userlist<br>done<br></font><div><br></div><div> </div><div><br></div></div></div>