Hi all,

 I'm attempting to setup mysql load balancing using HA/Proxy. Seemed pretty
straight forward at first.

I'm using Amazon ec2 for all nodes. First I made sure that the
haproxy nodes could contact the mysql boxes by opening up the security
group from the mysql boxes to the haproxy ones on port 3306.

I setup the following config:

global
    log 127.0.0.1 local0 notice
    user haproxy
    group haproxy

defaults
    log global
    retries 2
    timeout connect 3000
    timeout server 5000
    timeout client 5000

listen mysql-cluster
    bind 127.0.0.1:3306
    mode tcp
    option mysql-check user haproxy_check
    balance roundrobin
    server mysql-1 10.10.10.10:3306 check
    server mysql-2 10.10.10.11:3306 check

listen 0.0.0.0:80
    mode http
    stats enable
    stats uri /
    stats realm Strictly\ Private
    stats auth admin:secret

And ensured that haproxy could bind to non local IP's:

[root@ha1:/etc/haproxy] #grep ipv4 /etc/sysctl.conf
net.ipv4.ip_nonlocal_bind=1

[root@ha1:/etc/haproxy] #sysctl -p
net.ipv4.ip_nonlocal_bind = 1

Yet when I try to start up haproxy I get the following result:

[root@ha1:/etc/haproxy] #systemctl status haproxy
haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/usr/lib/systemd/system/haproxy.service; enabled)
   Active: inactive (dead) since Fri 2015-07-24 03:44:18 UTC; 9s ago
  Process: 25034 ExecStart=/usr/sbin/haproxy-systemd-wrapper -f
/etc/haproxy/haproxy.cfg -p /run/haproxy.pid (code=exited, status=0/SUCCESS)
 Main PID: 25034 (code=exited, status=0/SUCCESS)

Jul 24 03:44:18 ha1 systemd[1]: Starting HAProxy Load Balancer...
Jul 24 03:44:18 ha1 systemd[1]: Started HAProxy Load Balancer.
Jul 24 03:44:18 ha1 haproxy-systemd-wrapper[25034]:
haproxy-systemd-wrapper: executing /usr/sbin/haproxy -f
/etc/haproxy/hap...id -Ds
Jul 24 03:44:18 ha1 haproxy-systemd-wrapper[25034]: [ALERT] 204/034418
(25035) : *Starting proxy mysql-cluster: cannot bind s...:3306]*
Jul 24 03:44:18 ha1* h*aproxy-systemd-wrapper[25034]:
haproxy-systemd-wrapper: exit, haproxy RC=256
Hint: Some lines were ellipsized, use -l to show in full.

So it seems that haproxy is expecting to have mysql already listening on
port 3306. But mysql is runnign on two external nodes with port 3306 open
to the two haproxy machines.

What am I doing wrong? And how can I get this to work?

Thanks,
TIm
-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B

Reply via email to