Help me please, i have failed to start HAproxy


#1

i just newbie, i want to build HAproxy with my computer, with localhost using VMware. i have 3 servers, and i done with my configuration. but something happen when i want to start my HAproxy configuration. the configuration FAILED, can u please tell me where is the error with my configuration?
here is my configuration

here is my configuration

global
log 127.0.0.1 local0 notice
maxconn 2000
user jarkom
group jarkom
daemon

defaults
log global
mode http
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 http-in
bind 172.23.23.5:80
default_backend webservers
timeout connect 100
timeout client 100
timeout server 100

backend webservers
server web01 10.10.10.12:80 (IP dan port yang digunakan pada server1)
server web02 10.10.10.13:80 (IP dan port yang digunakan pada server2)
server web03 10.10.10.14:80 (IP dan port yang digunakan pada server3)
balance roundrobin
timeout connect 100
timeout client 100
timeout server 100

listen stat *:1936
stats enable
stats uri /
stats hiden-version

And the error said

root@ubuntu:/home/jarkom# service haproxy restart
Job for haproxy.service failed because the control process exited with error code.
See “systemctl status haproxy.service” and “journalctl -xe” for details.

and

root@ubuntu:/home/jarkom# service haproxy status
● haproxy.service - HAProxy Load Balancer
Loaded: loaded (/lib/systemd/system/haproxy.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2018-08-20 01:30:02 WIB; 10s ago
Docs: man:haproxy(1)
file:/usr/share/doc/haproxy/configuration.txt.gz
Process: 765 ExecStart=/usr/sbin/haproxy -Ws -f $CONFIG -p $PIDFILE $EXTRAOPTS (code=exited, status=14
Process: 14057 ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS (code=exited, status=1/FAILU
Main PID: 765 (code=exited, status=143)

Aug 20 01:30:02 ubuntu systemd[1]: haproxy.service: Control process exited, code=exited status=1
Aug 20 01:30:02 ubuntu systemd[1]: haproxy.service: Failed with result ‘exit-code’.
Aug 20 01:30:02 ubuntu systemd[1]: Failed to start HAProxy Load Balancer.
Aug 20 01:30:02 ubuntu systemd[1]: haproxy.service: Service hold-off time over, scheduling restart.
Aug 20 01:30:02 ubuntu systemd[1]: haproxy.service: Scheduled restart job, restart counter is at 5.
Aug 20 01:30:02 ubuntu systemd[1]: Stopped HAProxy Load Balancer.
Aug 20 01:30:02 ubuntu systemd[1]: haproxy.service: Start request repeated too quickly.
Aug 20 01:30:02 ubuntu systemd[1]: haproxy.service: Failed with result ‘exit-code’.
Aug 20 01:30:02 ubuntu systemd[1]: Failed to start HAProxy Load Balancer.

i will be appreciate and will get much knowledge from u master, thanks for your attention and your time :wink:


#2

I suggest you check out manually what the haproy error check returns:

haproxy -f /path/to/configfile -c


#3

I can imagine haproxy being unhappy with something like that in its config.


#4

OMG!!!.. yeah that is works for me… i know now… that comments will be read by script, Thanks master
and here the result:

~$ service haproxy status
● haproxy.service - HAProxy Load Balancer
Loaded: loaded (/lib/systemd/system/haproxy.service; enabled; vendor preset:
Active: active (running) since Sun 2018-08-26 17:14:43 WIB; 45min ago
Docs: man:haproxy(1)
file:/usr/share/doc/haproxy/configuration.txt.gz
Process: 1698 ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS (code
Main PID: 1699 (haproxy)
Tasks: 2 (limit: 2307)
CGroup: /system.slice/haproxy.service
├─1699 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/hapr
└─1700 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/hapr

Aug 26 17:14:43 ubuntu systemd[1]: Starting HAProxy Load Balancer…
Aug 26 17:14:43 ubuntu haproxy[1699]: [WARNING] 237/171443 (1699) : parsing [/et
Aug 26 17:14:43 ubuntu haproxy[1699]: [WARNING] 237/171443 (1699) : parsing [/et
Aug 26 17:14:43 ubuntu haproxy[1699]: [WARNING] 237/171443 (1699) : parsing [/et
Aug 26 17:14:43 ubuntu systemd[1]: Started HAProxy Load Balancer.


#5

thanks master, that was my fail (human error), i write comments without hastag (#)