I’m having issues with HAProxy not restarting when my Red Hat server restarts. I have a service script thats designed to call the haproxy start script on server reboot. Every time I try to start it with the server, it returns “Could not open configuration file /apps/haproxy/config/haproxy.cfg : Permission denied” in the nohup file. The service script is:
[Unit]
Description=HAProxy Load Balancer
After=syslog.target network.target
[Service]
User=user1
ExecStart=/apps/haproxy/bin/start.sh
ExecStop=/apps/haproxy/bin/stop.sh
Group=games
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
The start script it calls is:
#!/usr/bin/env sh
nohup haproxy -D -db -f /apps/haproxy/config/haproxy.cfg -p /apps/haproxy/config/haproxy.pid -sf $(cat /apps/haproxy/config/haproxy.pid) >> /apps/haproxy/bin/nohup.out 2>&1 &
So far, I’ve tried giving the configuration file 777 permissions, but this has not worked. I’m using versio 1.5.18 of HAProxy, and my configuration is as follows:
global
maxconn 4096
quiet
user root
group root
#/installs version
defaults
log global
mode http
retries 3
timeout client 3600s
timeout connect 3600s
timeout server 3600s
option tcplog
balance roundrobin
# Set up application listeners here.
listen admin
bind 127.0.0.1:22005
mode http
stats enable
stats show-node
stats uri /admin
listen stats :1939
mode http
log global
maxconn 10
timeout client 3600s
timeout server 3600s
timeout connect 3600s
timeout queue 3600s
stats enable
stats hide-version
stats show-node
stats uri /haproxy?stats
frontend http
maxconn 2000
bind 0.0.0.0:5050
acl test-service path_reg /test*
use_backend servers-test if test-service
backend servers-test
server www.testserver.com 127.0.0.1:8000 maxconn 100
A few caveats to my issue:
- Upgrading HAProxy is not an option for me. I’m trying to get a newer version, but there is a process that needs to be followed for that, and it has currently stalled
- I can’t really provide any logs, as I’m also still trying to get that working rsyslog, so for the moment, I can only use the informaiton provided by nohup. As it is, though, I don’t think logs would provide any additional insight, as when the server reboots HAProxy is not even restarting - it just gives the “permission denied” error.