Stopping and Restarting HAProxy

HAProxy supports a graceful and a hard stop.

  • The hard stop occurs when the SIGTERM signal is sent to the haproxy process, it immediately quits and all established connections are closed. The hard stop method is used for the “stop” or “restart” actions of the service management script.
  • The graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process. It consists in only unbinding from listening ports, but continue to process existing connections until they close. Once the last connection is closed, the process leaves. The graceful stop is used for the “reload” action which tries to seamlessly reload a new configuration in a new process.

Both of these signals may be sent by the new haproxy process itself during a reload or restart, so that they are sent at the latest possible moment and only if absolutely required.

You do this with the “-st” (hard) and “-sf” (graceful) options respectively.