HAProxy community

Reloading with expose-fd and multiple sockets?


#1

I am updating https://github.com/jsumners/haproxy-rhel7 and want to provide seamless reloads in the default configuration. I am unclear about reloading with multiple stats sockets. Let’s assume we have two stats sockets /run/haproxy.sock1 and /run/haproxy.sock2. Would we do the following for a reload?

> haproxy -c -f /etc/haproxy.cfg -q -x /run/haproxy.sock1 -x /run/haproxy.sock2
> kill -USR2 $(cat /run/haproxy.pid)

Or do we only have to specify the first socket?

Additionally, the documentation suggests using -sf $(cat /run/haproxy.pid) for gracefully terminating old processes. I do not know if this is possible with systemd (without a custom startup script). Will -sf simply read a file specified without having to cat it?


#2

I don’t see why you would need multiple stats sockets. 1 socket should suffice.

Please use the contributed systemd unit file in:
contrib/systemd/haproxy.service.in

http://git.haproxy.org/?p=haproxy-1.8.git;a=blob;f=contrib/systemd/haproxy.service.in

You still have to adjust it for seamless reloads, but that would be a minor change I guess:

https://cbonte.github.io/haproxy-dconv/1.8/management.html#3
https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#5.1-expose-fd%20listeners


#3

I appreciate you taking time to respond, but I’m having a difficult time seeing any answers in your response. When running multiple instances via nbproc one should have a corresponding socket for each process, unless I am mistaken. And I do know where the documentation is located. My questions stem directly from reading the documentation. It is not clear on the subject of these questions.


#4

You only mentioned multiple stats sockets in your first post, not nbproc/multiprocess mode.

I don’t see how multiprocess mode would work with seamless reloads, no, that’s not supported.


#5

I thought it would be implied since there is no reason to have multiple sockets otherwise.