2

Using ubuntu as my server I'm trying to set up load balancing using HAProxy.

When I try to run using "haproxy -f haproxy.cfg" i get this error.

[WARNING] 035/115820 (1148) : [haproxy.main()] Cannot raise FD limit to 8224. [ALERT] 035/115820 (1148) : Starting proxy webservice: cannot bind socket

I thought freeing up the port80 could solve the problem, so i uninstalled apache2 that might be using the port80. But to no avail still haven't solved my problem. So how can I kill an application that uses port 80?

my haproxy.cfg

    # this config needs haproxy-1.1.28 or haproxy-1.2.1

global
        log 127.0.0.1   local0
        log 127.0.0.1   local1 notice
        #log loghost    local0 info
        maxconn 4096
        #chroot /usr/share/haproxy
        user haproxy
        group haproxy
        daemon
        #debug
        #quiet

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        retries 3
        option redispatch
        maxconn 2000
        contimeout      5000
        clitimeout      50000
        srvtimeout      50000


listen webservice 192.168.1.120:80
        mode http
        stats enable
        stats refresh 10s
        stats hide-version
        cookie GALAXY insert
        balance roundrobin
        option httpclose
        option httpchk OPTIONS /health_check.html
        option forwardfor
        server RONAHPC 192.168.1.7:80 cookie GALAXY_SERVER_01 check
        server MAANPC 192.168.101:80 cookie GALAXY_SERVER_02 check

3 Answers 3

2
netstat -anop | grep ":80"

That should show you what is listening on that port. Ex:

 ~]# netstat -anop | grep ":80"
tcp        0      0 :::80                       :::*                        LISTEN      15566/httpd         off (0.00/0/0)

You could also use: lsof -Pni | grep ":80"

Ex:

~]# lsof -Pni | grep ":80"
httpd     15566 apache    4u  IPv6  6247436      0t0  TCP *:80 (LISTEN)
httpd     19069   root    4u  IPv6  6247436      0t0  TCP *:80 (LISTEN)
2
  • using lsof -Pni | grep ":80" got me no results therefore there must not have been any program using the port80 as of the moment. Apparently, I'm still having the same error. I couldn't think of way why this is happening. Feb 6, 2012 at 16:03
  • running sudo haproxy -f haproxy.cfg still gives me this error: [ALERT]037/153211 (1256) : Starting proxy webservice: cannot bind socket. I also my /etc/default/haproxy has ENABLED=1 already. Feb 7, 2012 at 7:34
3

got it to work by correcting the public ip for my server. It turns out I'm using an ip address which is not the ip address of the server that has the load balancer currently installed.

fixing this line solved my problem

listen webservice 192.168.1.120:80

2

I had the same problem as @tom-angelo-clemente, but solved it by using the broadcast address on the bind parameter of a frontend:

frontend wfe
   bind 0.0.0.0:80

This will bind the proxy to any IP address the machine is using (not sure about addresses on different NIC devices), so be careful when using this way if you have a private management interface and address you don't want to bind to.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .