User Tools

Site Tools


docs:tips_n_tricks:dovecot.html

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
docs:tips_n_tricks:dovecot.html [22.10.2017 23:11 CEST] – [Troubleshooting replication] peterdocs:tips_n_tricks:dovecot.html [01.02.2019 13:36 CET] (current) – [Remediation] peter
Line 5: Line 5:
 According to [[http://wiki2.dovecot.org/MailLocation/mbox#dotlocks|wiki2.dovecot.org]] the problem is solved by removing the write persmissions to the group on ''/var/spool/mail///username//''. According to [[http://wiki2.dovecot.org/MailLocation/mbox#dotlocks|wiki2.dovecot.org]] the problem is solved by removing the write persmissions to the group on ''/var/spool/mail///username//''.
  
-===== Troubleshooting replication =====+===== Replication ===== 
 +==== Troubleshooting ====
  
 **Note:** The locally running replicator allways pushes the local changes to the far side (provided it is running without the ''-R'' flag) **Note:** The locally running replicator allways pushes the local changes to the far side (provided it is running without the ''-R'' flag)
Line 11: Line 12:
   doveadm replicator status <username pattern>   doveadm replicator status <username pattern>
 //<username pattern>// is something like ''*@example.com'', ''user@example.com'', ''u*'' or just ''*'' //<username pattern>// is something like ''*@example.com'', ''user@example.com'', ''u*'' or just ''*''
 +
 +Run
 +
 +  doveadm replicator status '*' | fgrep ' y'
 +
 +to find failing mailboxes.
  
 Times shown are the time passed since last fast/full sync. Times shown are the time passed since last fast/full sync.
Line 17: Line 24:
 Accepts a username pattern as well, but works without it. Accepts a username pattern as well, but works without it.
  
-  doveadmin replicator replicate -f <username pattern>+  doveadm replicator replicate -f <username pattern>
 triggers a new full sync. (Needs to be called twice sometimes?) triggers a new full sync. (Needs to be called twice sometimes?)
  
-:!: ''doveadm force-resync'' is not related to replication! +<note tip>''doveadm force-resync'' is not related to replication!</note>
 Credits: Credits:
   * https://wiki.dovecot.org/Replication   * https://wiki.dovecot.org/Replication
-===== Monitoring Replication ===== 
  
-Maybe+==== Deduplication ==== 
 + 
 +Sometimes, root cause of replication troubles seem to be duplicated emails. Those might be cleaned up in mailboxes //INBOX// and //Spam// for account //user@example.com// by 
 + 
 +<code bash deduplicate.sh> 
 +while doveadm deduplicate -u user@example.com mailbox INBOX OR mailbox Spam 
 +do 
 +  fgrep -c Message-ID: example.com/user/mail/Spam xid.at/xen/mail/INBOX 
 +  echo "++++ `date` +++++" 
 +done 
 +</code> 
 + 
 +This will run forever ans should be stopped when numbers do not change any more. 
 +==== Monitoring ==== 
 +//This solution is for nagios-like monitoring systems// 
 + 
 +This needs a //sudo// entry to allow //nagios// running ''doveadm'' as //dovecot// 
 +<file bash check_dovecot.sh> 
 +  #! /bin/sh 
 +   
 +  # LANG=C doveadm replicator status|fgrep "'failed'" 
 +  repl_n_wait_fail="`LANG=C sudo -u dovecot doveadm replicator status|sed -ne \"s/^Waiting 'failed' requests *\([0-9]\+\) *$/\1/pg\"`" 
 +  # LANG=C doveadm replicator status|fgrep "'failed'" 
 +  # echo "\"$repl_n_wait_fail\"" 
 +   
 +  case "$repl_n_wait_fail" in 
 +  "0") echo "OK: doveadm replicator status: Waiting 'failed' requests $repl_n_wait_fail" 
 +       exit 0 ;; 
 +  "1") echo "WARN: doveadm replicator status: Waiting 'failed' requests $repl_n_wait_fail" 
 +       exit 1 ;; 
 +  *)   if [ "$repl_n_wait_fail" -gt 1 ] 
 +       then 
 +          echo "CRIT: doveadm replicator status: Waiting 'failed' requests $repl_n_wait_fail" 
 +          exit 2 
 +       fi ;; 
 +  esac 
 +   
 + 
 +  echo "UNKNOWN: Strange value in doveadm replicator status for  waiting 'failed' requests: $repl_n_wait_fail" 
 +  exit 3 
 +</file> 
 +{{tag>monitoring nagios}} 
 +{{entry>monitoring}} 
 +{{entry>nagios}} 
 + 
 +==== Remediation ==== 
 + 
 +Most cases I observed replication failures could be remedied by forcing deduplication. To my experience, ''dovecot deduplicate'' had to be run several times until all duplicate emails were removed. 
 + 
 +  dovecot deduplicate -u <user> '*' 
 + 
 +Repeat until
  
-  if doveadm replicator status  | fgrep "Waiting 'failedrequests     0" +<file bash> 
-  then +  grep -c '^Message-ID:path/to/mailbox 
-    echo "OK" +  grep '^Message-ID:' path/to/mailbox | sort -u | wc -l 
-  else +</file>
-    echo "ALARM" +
-  fi+
  
 +show the same number.   
 ======  ====== ======  ======
 {{tag>imap email dovecot}} {{tag>imap email dovecot}}
 {{entry>imap}} {{entry>imap}}
 {{entry>email}} {{entry>email}}
-{{entry>dovect}}+{{entry>dovecot}}
docs/tips_n_tricks/dovecot.html.1508706700.txt.gz · Last modified: 22.10.2017 23:11 CEST by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki