Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to launch HA Proxy 1.4.24 on an ubuntu 13 VM via sudo. My haproxy.cfg file is copied below. However, when I use sudo service haproxy start or try sudo /etc/init.d/haproxy start, the process not start up. Any ideas on troubleshooting this would be helpful. The config file appears to pass the configuration test (sudo haproxy -f haproxy.cfg -c results in "Configuration file is valid").
Also, Enabled flag in the haproxy file in /etc/init.d is set to 1. Port 80 does not appear to be bound by any other service.

Update: I had set the enabled flag to 1 in the /etc/init.d/haproxy file as opposed to in the /etc/default/haproxy file - fixing this change allowed me to run haproxy normally.

global
    maxconn     25000 # Total Max Connections. This is dependent on ulimit
    daemon
    nbproc      4 # Number of processing cores. Dual Dual-core Opteron is 4 cores for example.

defaults
    mode        http
    clitimeout  60000
    srvtimeout  30000
    contimeout  4000
    timeout http-request 5s  # added to tackle slow http requests
        option abortonclose
        option forwardfor


listen  http_proxy *:80
        #bind *:80
    balance roundrobin # Load Balancing algorithm
    option httpchk
    option forwardfor # This sets X-Forwarded-For
        default_backend bk_web

# Dynamic part of the application
backend bk_web
    ## Define your servers to balance
    balance roundrobin ## change to URL hashing
    cookie MYSRV insert indirect nocache  ## check this NOTE TO SELF
    server server1 0.0.0.0:81 weight 1 maxconn 512 check
    server server2 0.0.0.0:82 weight 1 maxconn 512 check
share|improve this question
1  
Try running haproxy directly with haproxy -f haproxy.cfg -db –  Nathan C Dec 10 '13 at 22:29
    
@Nathan C - the process runs fine when I use haproxy -f haproxy.cfg -db. However, when I try sudo service haproxy start (or sudo /etc/init.d/haproxy start), the process does not launch. Perhaps I should take a closer look at the haporxy file in /etc/init.d –  ali haider Dec 10 '13 at 22:42
2  
pilot error - I set the enabled flag in the /etc/init.d instead of /etc/default. Changing that fixed the issue - thank you Nathan and Kindule –  ali haider Dec 10 '13 at 22:45
add comment

1 Answer

up vote 3 down vote accepted

Your should use

sh -x /etc/init.d/haproxy start

and this will print debug infomation.And where you got wrong.

share|improve this answer
1  
I tried it earlier as well but did not pay enough attention to it - a closer look helped me realize the enabled flag was not setup in the correct place. I fixed it - accepting your answer –  ali haider Dec 10 '13 at 22:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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