Redundant Mail Server

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

  1. Fire Fox

    Fire Fox New Member

    Hi
    I use Ubuntu 20.04.2 and mariadb from mariadb.org
    I installed two mail servers as in https://www.howtoforge.com/tutorial/ispconfig-multiserver-setup-debian-ubuntu/3/
    After install, the problem is, the emails between the two servers cannot sync wtih dsync. Apparently it caused by
    Code:
    mysqld.sock
    run in different location that required by dovecot.

    check the log using,
    Code:
    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
    Code:
    /var/run/mysqld/mysqld.sock
    while mariadb runs
    Code:
    mysqld.sock
    at
    Code:
    /run/mysqld/mysqld.sock
    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
    Code:
    /etc/mysql/mariadb.conf.d/50-server.cnf
    from this,
    Code:
    socket = /run/mysqld/mysqld.sock
    to this,
    Code:
    socket = /var/run/mysqld/mysqld.sock
    if it doesn work, try also to edit mysqld.sock in
    Code:
    /etc/mysql/my.cnf
    Take note that when the email server starts, dovecot run first than mariadb. This make trouble since dovecot cannot find mysqld.sock runs at
    Code:
    /var/run/mysqld
    after the server run
    So after we edit mariadb settings like above and restart mariadb, we need to restart dovecot,
    Code:
    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
    Code:
    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:
    Code:
    # 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