0
votes
  1. I have a connection timeout error in the haproxy log: " -1/-1/50001 0 PR"
  2. haproxy stats page shows the mysql servers are up. So the health check is working. The stats page shows that there have been no connections made, as per the log file entries
  3. I can telnet to "192.168.202.82 3306" from the haproxy server.
  4. haproxy listens on 3308 and forwards to 3306. My best guess is that I've set this up incorrectly
  5. I'm using haproxy 2.4.4
  6. haproxy is working for the app servers, as you can see from the app01 and app02 entries in the log
  7. the haproxy.cfg and log entries are below.

Suggestions are very much appreciated!

haproxy.cfg:

global
    ulimit-n 500000
    maxconn 99999
    maxpipes 99999
    tune.maxaccept 500

    #log 127.0.0.1 local0
    #log 127.0.0.1 local1 notice

    log /dev/log local0
    chroot /var/lib/haproxy

    stats timeout 30s
    daemon

defaults
    log     global
    mode    http
    option  tcplog
    option  dontlognull
    retries 3
    maxconn 2000
    timeout connect 5000
    timeout client 50000
    timeout server 50000

#read/write all
frontend mysql_rw_front
    bind *:3306
    mode tcp
    default_backend mysql_rw_back
backend mysql_rw_back
    #balance leastconn
    #option tcpka
    option mysql-check user haproxy_check
    server db01 192.168.202.82:3306 check port 3306 inter 2000 rise 3 fall 2
    server db02 192.168.196.13:3306 check port 3306 inter 2000 rise 3 fall 2
    server db03 192.168.137.135:3306 check port 3306 inter 2000 rise 3 fall 2

#read db01, db02
frontend mysql_r_front
    mode tcp
    bind *:3308
    default_backend mysql_r_back
backend mysql_r_back
    #balance leastconn
    option tcpka
    option mysql-check user haproxy_check
    server db01 192.168.202.82:3306 check port 3306
    server db02 192.168.196.13:3306 check port 3306
    server db03 192.168.137.135:3306 check port 3306 backup

#write on db03
frontend mysql_w_front
    bind *:3307
    mode tcp
    default_backend mysql_w_back
backend mysql_w_back
    #balance leastconn
    #option tcpka
    option mysql-check user haproxy_check
    server db01 192.168.202.82:3306 check backup port 3306 inter 2000 rise 3 fall 2
    server db02 192.168.196.13:3306 check backup port 3306 inter 2000 rise 3 fall 2
    server db03 192.168.137.135:3306 check port 3306 inter 2000 rise 3 fall 2

frontend http_front
    bind *:80
    mode tcp
    default_backend http_back
backend http_back
    mode tcp
    #balance leastconn

    #option httpchk GET /ping
    #http-check expect string OK

    server app01 192.168.195.230:80 check port 80 inter 5000 rise 3 fall 2 send-proxy
    server app02 192.168.210.237:80 check port 80 inter 5000 rise 3 fall 2 send-proxy
    server app03 192.168.136.34:80 check port 80 inter 5000 rise 3 fall 2 send-proxy

frontend https_front
    bind *:443
    mode tcp
    default_backend https_back
backend https_back
    mode tcp
    #balance leastconn

    #option httpchk GET /ping
    #http-check expect string OK

    #check is using port 80 to avoid cert issues. this means health check does not include checking ssl certificates
    server app01 192.168.195.230:443 check port 80 inter 5000 rise 3 fall 2 send-proxy
    server app02 192.168.210.237:443 check port 80 inter 5000 rise 3 fall 2 send-proxy
    server app03 192.168.136.34:443 check port 80 inter 5000 rise 3 fall 2 send-proxy

listen  stats
    bind *:8080
    stats enable
    stats hide-version
    stats auth admin:**

log entry:

Sep 18 10:10:03 li1010-46 haproxy[22884]: 1.2.3.4:58514 [18/Sep/2021:10:09:13.163] https_front https_back/app01 1/0/50206 6427 cD 2/1/0/0/0 0/0
Sep 18 10:10:03 li1010-46 haproxy[22884]: 192.168.195.230:36462 [18/Sep/2021:10:09:13.425] mysql_r_front mysql_r_front/<NOSRV> -1/-1/50001 0 PR 1/1/0/0/0 0/0
Sep 18 10:10:53 li1010-46 haproxy[22884]: 192.168.195.230:36474 [18/Sep/2021:10:10:03.429] mysql_r_front mysql_r_front/<NOSRV> -1/-1/50000 0 PR 3/2/0/0/0 0/0
Sep 18 10:10:58 li1010-46 haproxy[22884]: 1.2.3.4:58277 [18/Sep/2021:10:10:08.562] https_front https_back/app02 1/0/50206 6443 cD 3/1/0/0/0 0/0
Sep 18 10:10:59 li1010-46 haproxy[22884]: 192.168.210.237:52646 [18/Sep/2021:10:10:09.055] mysql_r_front mysql_r_front/<NOSRV> -1/-1/50001 0 PR 2/2/0/0/0 0/0
Have you allowed connections from haproxy IPs in MySQL configurations?srimaln91