[Dovecot] replication howto

Michael Grimm trashcan at odo.in-berlin.de
Thu Mar 15 19:09:21 EET 2012


Hi --

On 15.03.2012, at 17:42, Matteo Cazzador wrote:

> Hello, excuse me but there is some documentation about replication now?

Not that I'm aware of.

> I dont' understand where i must put the lines below (dovecot.conf? ,
> 20-imap?)

You can put them wherever you wish, as long as you include that part
of your configuration. Myself, I'm still using a single dovecot.conf,
only.

> Another question, i use virtual users on mysql backend , so for
> replication i need to give ssh at every virtual users?
> Or i can use a only use a system ssh user?

If I'm not mistaken, you can use a single ssh user, and you could use 
the vmail user for instance. That's what I do, and I'm using sqlite for
userdb.

Here's my configuration:
-----------------------------------------------------------------------

If you choose to run ssh on a different port from the default one, you need:

   ## ssh command line used in dsync replication (ssh port added)	
   #
   dsync_remote_cmd = ssh -p 1234 -l%{login} %{host} doveadm dsync-server -u%u -l%{lock_timeout} -n%{namespace}



If not, you can start here:

   ## --- DSYNC REPLICATION ----------------------------------------
   #
   # aggregator, replicator, doveadm, and config needed, and
   # dsync_remote_cmd if running ssh via non-default port
   #
   service aggregator {
	# give enough permissions for mail processes
	#
	fifo_listener replication-notify-fifo {
		user = vmail
		mode = 0600
	}
	unix_listener replication-notify {
		user = vmail
		mode = 0600
	}
   }
   service replicator {
	# start replication at startup
	#
	process_min_avail = 1
   }
   service doveadm {
	# if you're using a single virtual user, set this to start ssh as vmail 
	# (not root)
	#
	user = vmail
   }
   service config {
	# needed to grant access to /var/run/dovecot/config for service doveadm
	#
	unix_listener config {
		user = vmail
 	}
   }



The following part is for server 1, only:

   ## --- PLUGINS ----------------------------------------
   #
   # dsync replication plugin
   #
   plugin {
	# this host replicates to remote host
	#
	mail_replica = remote:vmail at server2.domain

	# run full synchronization mode every other hour
	# (default is every 24 hours)
	#
	replication_full_sync_interval = 1 hours
   }



The following part is for server 2, only:

   ## --- PLUGINS ----------------------------------------
   #
   # dsync replication plugin
   #
   plugin {
	# this host replicates to remote host
	#
	mail_replica = remote:vmail at server1.domain

	# run full synchronization mode every other hour
	# (default is every 24 hours)
	#
	replication_full_sync_interval = 1 hours
   }

HTH,
Michael




More information about the dovecot mailing list