MySQL Forums
Forum List  »  Install & Repo

Re: too many connections from haproxy ip
Posted by: Nick R
Date: October 09, 2025 04:32AM

Hello Miguel,

One of our clients had faced the same issue. He had set up a MySQL application in a cluster of 1 main node and 2 slave nodes. There was one HAProxy instance to provide a single, highly available IP (VIP) that clients connect to — ensuring failover, load balancing, and redundancy.

We had resolved the issue by following these steps.

Solution:

Option 1: Increase MySQL connection limits

Run this in MySQL:

SET GLOBAL max_connections = 1000;


And for your specific user:

ALTER USER 'youruser'@'%' WITH MAX_USER_CONNECTIONS 0;


(0 means unlimited.)

Option 2: Tune HAProxy settings

In /etc/haproxy/haproxy.cfg, inside your backend block:

backend mysql-backend
balance roundrobin
option mysql-check user haproxy
timeout connect 5s
timeout server 30s
timeout client 30s
server mysql1 10.0.0.1:3306 maxconn 100
server mysql2 10.0.0.2:3306 maxconn 100


Adjust maxconn per server to limit how many concurrent connections HAProxy makes to MySQL.
Also ensure HAProxy closes idle ones:

timeout server 30s
timeout client 30s

I hope the above-mentioned steps will fix your issue. Please let me know if you are still receiving the same error so I can check the possible solution and let you know.

Options: ReplyQuote


Subject
Written By
Posted
Re: too many connections from haproxy ip
October 09, 2025 04:32AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.