Hi,
I have a problem with load balancing with haproxy to a 3 nodes percona xtradb cluster.
I made this setting in production and everything works perfect. But now i do exactly the same in Kvm enviroment with debian.
Here is my haproxy.cfg
global
log 127.0.0.1 local0 notice
user haproxy
group haproxy
defaults
log global
retries 2
timeout connect 5000
timeout server 50000
timeout client 50000
listen educaedu
bind 192.168.1.107:3306
mode tcp
option mysql-check user haproxy_check
balance roundrobin
server mysql1-dev 192.168.1.104:3306 check
server mysql2-dev 192.168.1.105:3306 check
server mysql3-dev 192.168.1.106:3306 check
listen 192.168.1.107 :8080
mode http
stats enable
stats uri /
stats realm Strictly\ Private
stats auth haproxy_root:debian
stats refresh 5s
The issue is that if I comment the User parameter ( option mysql-check #user haproxy_check) it seems to work fine. But otherwise don’t work.
The log tell me this:
Nov 25 11:31:49 localhost haproxy[12575]: Server educaedu/mysql1-dev is DOWN, reason: Layer7 wrong status, code: 0, info: “Access denied for user ‘haproxy_root’@‘192.168.1.107’ (using password: NO)”, check duration: 0ms. 2 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Nov 25 11:31:50 localhost haproxy[12576]: Server educaedu/mysql2-dev is DOWN, reason: Layer7 wrong status, code: 0, info: “Access denied for user ‘haproxy_root’@‘192.168.1.107’ (using password: NO)”, check duration: 1ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Nov 25 11:31:50 localhost haproxy[12576]: Server educaedu/mysql3-dev is DOWN, reason: Layer7 wrong status, code: 0, info: “Access denied for user ‘haproxy_root’@‘192.168.1.107’ (using password: NO)”, check duration: 1ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Nov 25 11:31:50 localhost haproxy[12576]: proxy educaedu has no server available!
and telnet to ip and port tell me this:
root@haproxy-dev:~# telnet 192.168.1.107 3306
Trying 192.168.1.107…
Connected to 192.168.1.107.
Escape character is ‘^]’.
Connection closed by foreign host.
Connect but close connection instantly.
When I try to connect to mysql this is the message:
root@haproxy-dev:~# mysql -u haproxy_check -P3306 -h 192.168.1.107 -pdebian
ERROR 2013 (HY000): Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0
The user Mysql_check has admin privileges on databases. My haproxy version is 1.4.25 but i tried with multiple versions.
Thanks in advanced.
Bruno