Multi-server mail problems [Solved]

Discussion in 'ISPConfig 3 Priority Support' started by TTZX, Nov 24, 2015.

  1. TTZX

    TTZX New Member HowtoForge Supporter

    I recently added a slave server to my single server installation and are having a few problems with mail. I loosely followed this guide to get things up and running: www.howtoforge.com/installing-a-web-email-and-mysql-database-cluster-on-debian-6.0-with-ispconfig-3

    I had problems with logging into the imap server with authentication failure with existing email accounts on the slave server. I haven't added any new email accounts. After changing dbname= and user= in the /etc/dovecot/dovecot-sql.conf file to match the master server I could log in fine. Was this the right thing to do or should the credentials be in both databases?

    I am now getting a lot of these error messages in my mail logs:
    Error: Transaction log /var/vmail/....../Maildir/dovecot.index.log: duplicate transaction log sequence (31)

    So I have 2 dovecot instances working on the same files and even sharing there log paths (they are in the directory mirrored by unison). What have I missed here? How are conflicts prevented?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The slave server shall connect to the mysql instance on the slave, not the master. connections are always to "localhost". Please change the connection details back to the original settings.

    The next step is to find out why the data did not replicate to the slave, ispconfig is doing this replication internally, so I'am not talking about mysql replication.

    1) Enable debugging for the slave server in the ispconfig interface on the master.
    2) Run:

    /usr/local/ispconfig/server/server.sh

    as root user on the shell and check the output for errors.
     
  3. TTZX

    TTZX New Member HowtoForge Supporter

    I run /usr/local/ispconfig/server/server.sh as root on the slave and got this output:
    PHP Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'ispcsrv3'@'<external IP>' (using password: YES) in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 62
    DB::__construct Access denied for user 'ispcsrv3'@'<external IP>' (using password: YES)

    The external IP is the IP of my router. The slave is behind NAT. The master is not. The master and slave are in different locations.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    The slave must be able to connect to the master mysql server. Did you open the mysql port in your firewall and did you forward the mysql port from your router to the internal IP of the master server? If thats ok, then check that the correct IP address is used for the ispcsrv 3 user in the master mysql server, you can check and alter the Ip with e.g. the phpmyadmin user manager.
     
  5. TTZX

    TTZX New Member HowtoForge Supporter

    Yes the master and slave mysql servers can connect to each other. Master to master replication is working fine.

    I don't quite understand what the above command was doing. I run this on the slave and it complained it could not reach the mysql server. Does that mean it was trying to contact the master mysql server? If so then this is the wrong IP address to reach the master mysql server. This is the IP address for the master to reach the slave.
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    That's not relavant for this issue as it is not used here. The problem is that the mysql connection from slave to master with user ispcsrv3 is not working.
     
  7. TTZX

    TTZX New Member HowtoForge Supporter

    I understand now after looking at the phpmyadmin user manager. It had Host: <fqdn> instead of Host:<IP> for User: ispcsrv3
    I have changed that now and running /usr/local/ispconfig/server/server.sh returns:
    25.11.2015-00:18 - DEBUG - Set Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
    25.11.2015-00:18 - DEBUG - Remove Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
    finished.

    Logging in via roundcube still fails after changing /etc/dovecot/dovecot-sql.conf back.
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    There should be a record for the fqdn and one for the IP. Maybe you did not edit the /etc/hosts files on both server nodes before you installed ispconfig?

    Ok. Please login to ispconfig, go to tools > resync and resync all mail accounts. this will force the data to be pushed to the jobqueue again so that the slave can pick it up.
     
  9. TTZX

    TTZX New Member HowtoForge Supporter

    It seems I missed adding the master IP to the slave hosts file an visa versa. Each node had its own IP and fqdn. However the slave has a private IP (192.168.0.3) because it is behind NAT. The master cannot reach the slave via this IP. This IP is in the db for user ispcsrv3. Is this going to cause problems? Should I be changing anything in the hosts file or the db?

    I can log into roundcube on the slave now after resyncing all the mail accounts. However I am still getting these error messages in the master server mail log when my mail client is accessing the slave server:
    Error: Transaction log /var/vmail/....../Maildir/dovecot.index.log: duplicate transaction log sequence (31)
    And when I try and delete mail it comes back again. So I still don't have it configured correctly.
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    The ispconfig replication part should be ok now when the server.sh script does not show errors anymore. When the hosts files are not crrect then you should alter the files on both nodes so that MySQL is able to do the authentication correctly. ISPConfig connects by hostname and not IP but MySQL will check the IP as well, so they have to be correct.

    Regarding the transactin log issues, maybe you should consider to replace the unison sync with dovect dsync as dovecot is able to sync two servers internally without the help of an external file replication program.
     
  11. TTZX

    TTZX New Member HowtoForge Supporter

    So unison sync doesn't work properly with dovecot when writing to both imap servers. Dovecot dsync looks like a much better way to do it anyway. I didn't know about dsync when I setup unison.

    Thanks a lot for your help. Looks like my issues are solved.
     

Share This Page