Quantcast
Channel: Serverphorums.com - HAProxy
Viewing all articles
Browse latest Browse all 5112

Issue setting limits from Systemd to Haproxy service (1 reply)

$
0
0
Hello,



I try to limit the number of file descriptors using the variable
"LimitNOFILE" inside the following systemd unit:

[Unit]
Description=HAProxy Load Balancer
After=network.target

[Service]
ExecStartPre=/usr/local/sbin/haproxy -f /etc/haproxy/haproxy.cfg -c -q
ExecStart=/usr/local/sbin/haproxy-systemd-wrapper
-f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid
ExecReload=/bin/kill -USR2 $MAINPID
KillMode=mixed
Restart=always
LimitNOFILE=5 # For testing only...

[Install]
WantedBy=multi-user.target



But it only works for the first process spawned, wich is
haproxy-systemd-wrapper:

root 4421 0.0 0.1 17084 1508 ? Ss 10:11
0:00 /usr/local/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg
-p /run/haproxy.pid
nobody 4423 0.0 0.4 30104 4436 ? S 10:11 0:00
\_ /usr/local/sbin/haproxy -f /etc/haproxy/haproxy.cfg
-p /run/haproxy.pid -Ds
nobody 4424 0.0 0.2 30104 2508 ? Ss 10:11 0:00
\_ /usr/local/sbin/haproxy -f /etc/haproxy/haproxy.cfg
-p /run/haproxy.pid -Ds

# cat /proc/4421/limits
Limit Soft Limit Hard Limit
Units
Max open files 5 5
files

# cat /proc/4423/limits
Limit Soft Limit Hard Limit
Units
Max open files 64013 64013
files

# cat /proc/4424/limits
Limit Soft Limit Hard Limit
Units
Max open files 64013 64013
files



The process who listen in the socket is the last one, 4424, with the bad
settings:

# netstat -ntap | grep haproxy
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
4424/haproxy
tcp 0 0 0.0.0.0:8088 0.0.0.0:* LISTEN
4424/haproxy



haproxy-systemd-wrapper would not have to pass these values?

Is it possible to pass the limits from systemd to the listening haproxy
process?


Thanks,

Viewing all articles
Browse latest Browse all 5112

Trending Articles