I am running Ubuntu 18.04 My config files and other info are below. I installed using apt-get.

log /dev/log local0 log /dev/log local1 notice chroot /var/lib/haproxy stats timeout 30s user haproxy group haproxy daemon defaults log global mode http option httplog option dontlognull timeout connect 5000 timeout client 50000 timeout server 50000 frontend http_front bind *:80 stats uri /haproxy?stats default_backend http_back backend http_back balance roundrobin server server1 ip:port check server server2 ip:port check 

I typed in haproxy -f /etc/haproxy/haproxy.cfg -db and I received this output.

[ALERT] 359/031621 (6151) : parsing [/etc/haproxy/haproxy.cfg:2]: unknown keyword ‘log’ out of section. [ALERT] 359/031621 (6151) : parsing [/etc/haproxy/haproxy.cfg:3]: unknown keyword ‘chroot’ out of section. [ALERT] 359/031621 (6151) : parsing [/etc/haproxy/haproxy.cfg:4]: unknown keyword ‘stats’ out of section. [ALERT] 359/031621 (6151) : parsing [/etc/haproxy/haproxy.cfg:5]: unknown keyword ‘user’ out of section. [ALERT] 359/031621 (6151) : parsing [/etc/haproxy/haproxy.cfg:6]: unknown keyword ‘group’ out of section. [ALERT] 359/031621 (6151) : parsing [/etc/haproxy/haproxy.cfg:7]: unknown keyword ‘daemon’ out of section. [ALERT] 359/031621 (6151) : parsing [/etc/haproxy/haproxy.cfg:20] : unknown keyword ‘jstats’ in ‘frontend’ section [ALERT] 359/031621 (6151) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg [ALERT] 359/031621 (6151) : Fatal errors found in configuration. 

My Haproxy status.

Dec 25 02:41:58 admin systemd[1]: haproxy.service: Scheduled restart job, restart counter is at 5. Dec 25 02:41:58 admin systemd[1]: Stopped HAProxy Load Balancer. Dec 25 02:41:58 admin systemd[1]: haproxy.service: Start request repeated too quickly. Dec 25 02:41:58 admin systemd[1]: haproxy.service: Failed with result ‘exit-code’. Dec 25 02:41:58 admin systemd[1]: Failed to start HAProxy Load Balancer. 

1 Answer

From the errors you got out of the haproxy -f /etc/haproxy/haproxy.cfg -db command, the issue is that you did not set the section of the configs in the first section of your file. From a quick Google search, that section should be named global.

global log /dev/log local0 log /dev/log local1 notice chroot /var/lib/haproxy stats timeout 30s user haproxy group haproxy daemon 

And I assume you fixed the last config error

[ALERT] 359/031621 (6151) : parsing [/etc/haproxy/haproxy.cfg:20] : unknown keyword ‘jstats’ in ‘frontend’ section 

As the key looks to be changed to stats instead of jstats

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy