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

        log   local0
        log   local1 notice
        #log loghost    local0 info
        maxconn 4096
        #chroot /usr/share/haproxy
        user haproxy
        group haproxy

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

listen webservice
        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 cookie GALAXY_SERVER_01 check
        server MAANPC 192.168.101:80 cookie GALAXY_SERVER_02 check

migrated from Feb 5 '12 at 14:38

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted
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"


~]# lsof -Pni | grep ":80"
httpd     15566 apache    4u  IPv6  6247436      0t0  TCP *:80 (LISTEN)
httpd     19069   root    4u  IPv6  6247436      0t0  TCP *:80 (LISTEN)
  • 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. – Tom Angelo Clemente Feb 6 '12 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. – Tom Angelo Clemente Feb 7 '12 at 7:34

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

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

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.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.