HAProxy Fails to Start Ubuntu 16.04


#1

I can’t seem to get my HAProxy to start, any ideas whats causing the problem?

root@haproxy-www:/# service haproxy restart
root@haproxy-www:/# service haproxy status
haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/lib/systemd/system/haproxy.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Mon 2017-10-02 17:21:11 AEDT; 4s ago
     Docs: man:haproxy(1)
           file:/usr/share/doc/haproxy/configuration.txt.gz
  Process: 11014 ExecStart=/usr/sbin/haproxy-systemd-wrapper -f ${CONFIG} -p /run/haproxy.pid $EXTRAOPTS (code=exited, status=0/SUCCESS)
  Process: 11011 ExecStartPre=/usr/sbin/haproxy -f ${CONFIG} -c -q (code=exited, status=0/SUCCESS)
 Main PID: 11014 (code=exited, status=0/SUCCESS)

Oct 02 17:21:11 haproxy-www systemd[1]: haproxy.service: Service hold-off time over, scheduling restart.
Oct 02 17:21:11 haproxy-www systemd[1]: Stopped HAProxy Load Balancer.
Oct 02 17:21:11 haproxy-www systemd[1]: haproxy.service: Start request repeated too quickly.
Oct 02 17:21:11 haproxy-www systemd[1]: Failed to start HAProxy Load Balancer.
root@haproxy-www:/# 

Here is my haproxy.cfg file

global log /dev/log local0 log /dev/log local1 notice chroot /var/lib/haproxy stats socket /run/haproxy/admin.sock mode 660 level admin stats timeout 30s user haproxy group haproxy daemon

    # Default SSL material locations
    ca-base /etc/ssl/certs
    crt-base /etc/ssl/private

    # Default ciphers to use on SSL-enabled listening sockets.
    # For more information, see ciphers(1SSL). This list is from:
    #  https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
    ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
    ssl-default-bind-options no-sslv3

defaults
        log     global
        mode    tcp
        option  tcplog
        option  dontlognull
        timeout connect 5000
        timeout client  50000
        timeout server  50000
        errorfile 400 /etc/haproxy/errors/400.http
        errorfile 403 /etc/haproxy/errors/403.http
        errorfile 408 /etc/haproxy/errors/408.http
        errorfile 500 /etc/haproxy/errors/500.http
        errorfile 502 /etc/haproxy/errors/502.http
        errorfile 503 /etc/haproxy/errors/503.http
        errorfile 504 /etc/haproxy/errors/504.http

frontend www
        bind ***.***.***.**:80
        default_backend site-backend

backend site-backend
        balance roundrobin
        mode tcp
        server webserver-1 10.240.0.178:80 check
        server webserver-2 10.240.0.42:80 check

Thank you, I really appreciate the help =)


#2

haproxy.service: Start request repeated too quickly.

Looks like systemd received multiple start requests in a short time.

Stop it, wait and start it once, not multiple times.

service haproxy stop
sleep 30
service haproxy start

#3

It might be there is still a process named haproxy, which does not killed and again restarted with command: service haproxy restart, you might alternate it with first kill the haproxy by command: #killall haproxy , and then use the above mentioned command (# service haproxy restart, and # service haproxy status).

If above formula doesnot work, then kill all process related haproxy [#killall haproxy], and start with #/sbin/haproxy -f /etc/haproxy/haproxy.cfg.
It shall work.

All the Best !!!


#4

Hi,
had used ansible ocata for installation of new server in openstack
rest services are fine but haproxy fails to start
service haproxy status
● haproxy.service - HAProxy Load Balancer
Loaded: loaded (/lib/systemd/system/haproxy.service; enabled; vendor preset:
Active: inactive (dead) (Result: exit-code) since Tue 2018-01-30 22:48:54 PST
Docs: man:haproxy(1)
file:/usr/share/doc/haproxy/configuration.txt.gz
Process: 3756 ExecStartPre=/usr/sbin/haproxy -f ${CONFIG} -c -q (code=exited,

Jan 30 22:48:54 infra4 systemd[1]: haproxy.service: Control process exited, code
Jan 30 22:48:54 infra4 systemd[1]: Failed to start HAProxy Load Balancer.
Jan 30 22:48:54 infra4 systemd[1]: haproxy.service: Unit entered failed state.
Jan 30 22:48:54 infra4 systemd[1]: haproxy.service: Failed with result 'exit-cod
Jan 30 22:48:54 infra4 systemd[1]: haproxy.service: Service hold-off time over,
Jan 30 22:48:54 infra4 systemd[1]: Stopped HAProxy Load Balancer.
Jan 30 22:48:54 infra4 systemd[1]: haproxy.service: Start request repeated too q
Jan 30 22:48:54 infra4 systemd[1]: Failed to start HAProxy Load Balancer.
Jan 30 22:52:12 infra4 systemd[1]: haproxy.service: Unit cannot be reloaded beca
Jan 30 22:52:24 infra4 systemd[1]: Stopped HAProxy Load Balancer.
…have tried both methods still its not working


#5

Ansible managed

global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
maxconn 4096
tune.bufsize 384000
stats socket /var/run/haproxy.stat level admin mode 600
ssl-default-bind-options no-sslv3
tune.ssl.default-dh-param 2048

defaults
log global
option dontlognull
option redispatch
retries 3
timeout client 50s
timeout connect 10s
timeout http-request 5s

    timeout server 50s
    maxconn 4096

Ansible managed

frontend aodh_api-front-1
bind 50.197.137.248:8042 ssl crt /etc/ssl/private/haproxy.pem ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
option httplog
option forwardfor except 127.0.0.0/8
option http-server-close
reqadd X-Forwarded-Proto:\ https
mode http
default_backend aodh_api-back

frontend aodh_api-front-2
bind ...:8042
option httplog
option forwardfor except 127.0.0.0/8
option http-server-close

mode http
default_backend aodh_api-back

backend aodh_api-back
mode http
balance leastconn
stick store-request src
stick-table type ip size 256k expire 30m
option forwardfor
option httplog
option httpchk HEAD /

server infra1_aodh_container-b3692fef some ip:8042 check port 8042 inter 12000 rise 4 fall 4

#6

Post the entire systemd status output, you’ve cut the lines and we can’t see everything.

Also check the configuration with haproxy -f <config-file> -c