haproxy doesn't start

44,727

Solution 1

Edit /etc/default/haproxy and make sure it has a line that says ENABLED=1 in it.

The default is ENABLED=0. This is done because haproxy has no sane default configuration, so you need to first configure it, then enable it.

Solution 2

I had the same issue, where setting ENABLED had no effect due to the "test" line always failing. Found the reason: you have to edit /etc/default/haproxy instead of the init script.

Solution 3

I know this a year old thread.. but just trying to share what i have learned..

use /etc/init.d/haproxy reload or service haproxy reload and it will reload fine.. afterall we just want it to start right ;)

Solution 4

Did you try to start it as root, or with sudo? If you are like me, you sometimes forget to add sudo to the front of the commands. I tried all your commands without sudo, and they failed as you described. However, with sudo in front of them, using a default haproxy.cfg file from install, it is now running without problems. Just thought I'd point that even with the correct configs, for me it won't go without sudo.

Solution 5

I ran into this same issue after first installing the ubuntu maintained package and then (after realizing the version did not support the feature i needed) Installing a ppa newer version of haproxy. The init.d script that i wound up with pointed to /usr/sbin/haproxy when in fact my executable was in /usr/local/sbin/haproxy. the debug output "sh -xv /etc/init.d/haproxy start" mentioned earlier made this problem pretty obvious.

Share:
44,727

Related videos on Youtube

vin
Author by

vin

assaflavie.com

Updated on September 17, 2022

Comments

  • vin
    vin over 1 year

    Installed a new Ubuntu 10.04 server and logging in as root I installed haproxy using apt-get.

    I can run haproxy directly as a daemon but when I do /etc/init.d/haproxy start nothing happens.. not even an error message.

    netstat -a shows nothing is using the http port I'm trying to balance with haproxy...

    Ideas?

    Edit

    1. I noticed that apt-get install haproxy says this in the end:

      update-rc.d: warning: /etc/init.d/haproxy missing LSB information update-rc.d: see http://wiki.debian.org/LSBInitScripts

    2. /etc/default/haproxy says ENABLED=1

    Debugging Output for sh -xv /etc/init.d/haproxy start

    #!/bin/sh
    #
    # chkconfig: - 85 15
    # description: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited \
    #              for high availability environments.
    # processname: haproxy
    # config: /etc/haproxy.cfg
    # pidfile: /var/run/haproxy.pid
    
    # Source function library.
    if [ -f /etc/init.d/functions ]; then
      . /etc/init.d/functions
    elif [ -f /etc/rc.d/init.d/functions ] ; then
      . /etc/rc.d/init.d/functions
    else
      exit 0
    fi
    + [ -f /etc/init.d/functions ]
    + [ -f /etc/rc.d/init.d/functions ]
    + exit 0
    root@li267-63:~#
    
  • vin
    vin over 13 years
    I set ENABLED=1, still nothing..
  • SpamapS
    SpamapS over 13 years
    Assaf, you still need to configure haproxy. If the config file is not correct, it won't start, and probably has printed errors into the system logs (check /var/log/daemon.log and /var/log/syslog)
  • vin
    vin almost 13 years
    :) yes, done as root
  • Nikolay Fominyh
    Nikolay Fominyh about 12 years
    Why it does not start without any verbose message? It's really confusing!
  • Sandeep
    Sandeep about 9 years
    I'd like to upvote this at least twice.