mysqlmariadbhaproxydatabase-replicationgalera

2013 - Lost connection to MySQL server at 'reading initial communication packet' system error: 0 while trying to connect to MariaDB over HAProxy


I am trying to connect to MariaDB with using HAProxy load balancer, but when I try to connect to HAProxy it returns that error. I tried all the links on the stackoverflow about this error but they did not work for me. What should I do?

2013 - Lost connection to MySQL server at 'reading initial communication packet',
system error: 0 "Internal error/check (Not system error)"

I have MariaDB Galera cluster with 3 nodes and HAProxy configuratios that I used are below.

listen testgalera
    bind 10.131.63.83:3306
    balance source
    mode tcp
    option tcpka
    option mysql-check user haproxy
    server db1 10.131.60.8:3306 check weight 1
    server db2 10.131.60.35:3306 check weight 1
    server db3 10.131.61.117:3306 check weight 1

Solution

  • Most of HAProxy with Galera tutorials uses the given configurations but one row causes the error and if we delete it nothing changes, the HAProxy works well without the row "option mysql-check user haproxy"

    The HAProxy configuration must be like this for MariaDB Galera clusters:

    listen testgalera
        bind 10.131.63.83:3306
        balance source
        mode tcp
        option tcpka
        server db1 10.131.60.8:3306 check weight 1
        server db2 10.131.60.35:3306 check weight 1
        server db3 10.131.61.117:3306 check weight 1