Hello Nenad,

   Jul 24 03:44:18 ha1 haproxy-systemd-wrapper[25034]: [ALERT]
>          204/034418 (25035) : *Starting proxy mysql-cluster: cannot bind
>          s...:3306]*


Nothing listening on the port I'm trying to bind to: 3306

[root@ha1:~] #ss -lpt | fgrep 3306
[root@ha1:~] #lsof -i :3306
[root@ha1:~] #netstat -tulpn | grep -i listen | grep 3306
[root@ha1:~] #

While we're on the subject of listening ports, here's a list of all
listening ports on the haproxy host:

[root@ha1:~] #netstat -tulpn | grep -i listen
tcp        0      0 0.0.0.0:35145           0.0.0.0:*
LISTEN      -
tcp        0      0 0.0.0.0:56814           0.0.0.0:*
LISTEN      16346/rpc.statd
tcp        0      0 0.0.0.0:111             0.0.0.0:*
LISTEN      16455/rpcbind
tcp        0      0 0.0.0.0:22              0.0.0.0:*
LISTEN      16396/sshd
tcp6       0      0 :::49349                :::*
LISTEN      16346/rpc.statd
tcp6       0      0 :::111                  :::*
LISTEN      16455/rpcbind
tcp6       0      0 :::47314                :::*
LISTEN      -
tcp6       0      0 :::22                   :::*
LISTEN      16396/sshd

I thought I was beginning to understand this problem. That haproxy was
trying to bind on port 3306 from the mysql host on another machine. But
come to think of it, that doesn't make a lot of sense.

Because I already have haproxy setup for some web servers, and there it
creates port 80 on the haproxy node. It's not trying to connect to a
foreign source. Not sure where I got that idea!!

I also tried binding the mysql section to another port that wasn't in use.
I tried port 3307,3308. I even tried binding the mysql section of the
config to a weird port I just grabbed off of the top of my head. I tried
binding it to port 4444.

And there I still got a bind error:

 [ALERT] 204/223303 (13081) : Starting proxy mysql-cluster: cannot bind
socket [0.0.0.0:4444]


 Now watch this!! If I bind the mysql section to port 80 instead of any
other port.. haproxy starts up without complaint!

listen mysql-cluster
    bind 0.0.0.0:80
    mode tcp
    option mysql-check user haproxy_check
    balance roundrobin
    server mysql-1 10.0.0.xxx :3306 check
    server mysql-2 10.0.0.xxx:3306 check

[root@ha1:/etc/haproxy] #systemctl status haproxy
haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/usr/lib/systemd/system/haproxy.service; enabled)
   Active: active (running) since Fri 2015-07-24 22:35:03 UTC; 4s ago
 Main PID: 13213 (haproxy-systemd)
   CGroup: /system.slice/haproxy.service
           ├─13213 /usr/sbin/haproxy-systemd-wrapper -f
/etc/haproxy/haproxy.cfg -p /run/haproxy.pid
           ├─13214 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p
/run/haproxy.pid -Ds
           └─13215 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p
/run/haproxy.pid -Ds

Jul 24 22:35:03 ha1 systemd[1]: Starting HAProxy Load Balancer...
*Jul 24 22:35:03 ha1 systemd[1]: Started HAProxy Load Balancer.*
Jul 24 22:35:03 ha1 haproxy-systemd-wrapper[13213]:
haproxy-systemd-wrapper: executing /usr/sbin/haproxy -f
/etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds

Ok. What...the...heck!!

So why do you think that haproxy is only happy starting up on port 80? I
would think that I should be able to specify any arbitrary port for it to
listen on in a 'listen' sub-block.

I guess I could have my app contact the database using port 80. But that's
a little... weird. I installed haproxy using yum from the 'updates'
repository. Is there any reason anyone can think of as to why haproxy
refuses to start on any port other than port 80??

Thanks,
Tim






On Fri, Jul 24, 2015 at 4:59 PM, Nenad Merdanovic <ni...@nimzo.info> wrote:

> Hello Tim,
>
> >     On Fri, Jul 24, 2015 at 1:46 PM, Tim Dunphy <bluethu...@gmail.com
> >     <mailto:bluethu...@gmail.com>> wrote:
>
> >         listen mysql-cluster
> >             bind 127.0.0.1:3306 <http://127.0.0.1:3306>
> >
> >             mode tcp
> >             option mysql-check user haproxy_check
> >             balance roundrobin
> >             server mysql-1 10.10.10.10:3306 <http://10.10.10.10:3306>
> check
> >             server mysql-2 10.10.10.11:3306 <http://10.10.10.11:3306>
> check
> >
> >         Jul 24 03:44:18 ha1 haproxy-systemd-wrapper[25034]: [ALERT]
> >         204/034418 (25035) : *Starting proxy mysql-cluster: cannot bind
> >         s...:3306]*
>
> Can you check if something is listening on 127.0.0.1:3306 (netstat, ss,
> lsof)? For example:
> ss -lpt | fgrep 3306
>
> Regards,
> Nenad
>



-- 
GPG me!!

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


On Fri, Jul 24, 2015 at 4:59 PM, Nenad Merdanovic <ni...@nimzo.info> wrote:

> Hello Tim,
>
> >     On Fri, Jul 24, 2015 at 1:46 PM, Tim Dunphy <bluethu...@gmail.com
> >     <mailto:bluethu...@gmail.com>> wrote:
>
> >         listen mysql-cluster
> >             bind 127.0.0.1:3306 <http://127.0.0.1:3306>
> >
> >             mode tcp
> >             option mysql-check user haproxy_check
> >             balance roundrobin
> >             server mysql-1 10.10.10.10:3306 <http://10.10.10.10:3306>
> check
> >             server mysql-2 10.10.10.11:3306 <http://10.10.10.11:3306>
> check
> >
> >         Jul 24 03:44:18 ha1 haproxy-systemd-wrapper[25034]: [ALERT]
> >         204/034418 (25035) : *Starting proxy mysql-cluster: cannot bind
> >         s...:3306]*
>
> Can you check if something is listening on 127.0.0.1:3306 (netstat, ss,
> lsof)? For example:
> ss -lpt | fgrep 3306
>
> Regards,
> Nenad
>



-- 
GPG me!!

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

Reply via email to