use dovecot to replicate your mails

Discussion in 'Tips/Tricks/Mods' started by florian030, Jul 2, 2014.

  1. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    With dovecot 2.x you can sync your mails over tcp (or ssh) between two servers.

    Just install the latest dovecot-version.

    Comment-out the iterate_query from /etc/dovecot/dovecot-sql.conf:
    Code:
    iterate_query = SELECT email as user FROM mail_user
    And add the settings for the replication dovecot.conf:

    Code:
    # Enable the replication plugin globally
    mail_plugins = $mail_plugins notify replication
    
    # The mail processes need to have access to the replication-notify fifo and socket.
    service aggregator {
      fifo_listener replication-notify-fifo {
        user = vmail
        mode = 0666
      }
      unix_listener replication-notify {
        user = vmail
        mode = 0666
      }
    }
    
    # Enable doveadm replicator commands
    service replicator {
      unix_listener replicator-doveadm {
        mode = 0666
      }
    }
    
    # Create a listener for doveadm-server
    service doveadm {
      user = vmail
      inet_listener {
        port = 12345
      }
    }
    
    # configure how many dsyncs can be run in parallel (10 by default)
    replication_max_conns = 10
    
    # tell doveadm client to use this port by default
    doveadm_port = 12345
    
    #Both the client and the server also need to have a shared secret
    doveadm_password = secret
    
    # use tcp:hostname as the dsync target
    plugin {
      mail_replica = tcp:anotherhost.example.com # use doveadm_port
      #mail_replica = tcp:anotherhost.example.com:12345 # use port 12345 explicitly
    }
    
    service config {
      unix_listener config {
        user = vmail
      }
    }
    Afterwards dovecot keeps your mails in sync between two servers. You can also create backups (no replication) with doveadm.

    You may find additional infos here.
     

Share This Page