Redundant Mail Server

Discussion in 'Server Operation' started by Fire Fox, Apr 25, 2021.

  1. Fire Fox

    Fire Fox New Member

    I use Ubuntu 20.04.2 and mariadb from
    I installed two mail servers as in
    After install, the problem is, the emails between the two servers cannot sync wtih dsync. Apparently it caused by
    run in different location that required by dovecot.

    check the log using,
    journal -eu dovecot
    Error: mysql(localhost): Connect failed to database (dbispconfig): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
    dovecot needs mysqld.sock run in
    while mariadb runs
    the solution to this is quiet simple: because the mysql.sock file is created when MariaDB starts and is removed when MariaDB is shutdown. It won't exist if MariaDB is not running; so we need to edit edit file
    from this,
    socket = /run/mysqld/mysqld.sock
    to this,
    socket = /var/run/mysqld/mysqld.sock
    if it doesn work, try also to edit mysqld.sock in
    Take note that when the email server starts, dovecot run first than mariadb. This make trouble since dovecot cannot find mysqld.sock runs at
    after the server run
    So after we edit mariadb settings like above and restart mariadb, we need to restart dovecot,
    service mariadb restart
    service dovecot restart
    That's it! after that the emails on the servers start to sync

    when the mail server starts, is there a way we can make dovecot runs after mariadb starts? in other words, can we let mariadb starts first and after that dovecot? otherwise, when the server resume from after blackout, it needs manual intervention to restart dovecot to make the emails sync. in case the servers are in far far away, how do i know if i should restart dovecot?
    Last edited: Apr 25, 2021
    ahrasis likes this.
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Ubuntu 20 uses systemd, which allows startup script starting in required order.
    Use Internet Search Engines with something like
    systemd startup script order
    to find documentation.
    ahrasis likes this.
  3. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    It should work out of the box, I did many tests with this tutorial. I'll do a test later...
  4. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    I have a ubuntu 20.04 workstation and on it /var/run is a symlink to /run:
    # ls -ld /run /var/run
    drwxr-xr-x 47 root root 1540 Apr 26 06:41 /run
    lrwxrwxrwx  1 root root    4 Nov 18  2017 /var/run -> /run
    So either path you use ends up in the same file. I don't have any Ubuntu mail servers to check things with dovecot, but I suspect your problem is not the file path.

Share This Page