Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restore HAProxy stats

Tags:

haproxy

I use following command to restart HAProxy, when changing the configurration file:

/usr/local/sbin/haproxy -f /etc/haproxy.cfg -p /var/run/haproxy.pid -sf $(</var/run/haproxy.pid)

Sadly after the HAProxy is back all stats of the previous launch are away.

Is there a possibility in HAProxy to restore stats from a previous HAProxy start?

like image 875
David Schilling Avatar asked Jun 14 '26 11:06

David Schilling


2 Answers

As of version 1.6, you can dump server states into a flat file right before performing the reload and let the new process know where the states are stored. See example here:seamless_reload

The "show servers state" command is used to keep servers uptime and healthy status cross reload, but it doesn't give session data, or bytes in/out, etc. "show stat" command can dump these stats to a file that you can use to create a report later, although HAproxy doesn't have a feature to reload this information.

like image 104
Xueshan Avatar answered Jun 18 '26 01:06

Xueshan


Can't be done unfortunately. HAProxy's stats are all in memory, so when restarting (even gracefully with -sf), those stats get lost.

like image 39
Liam Gretton Avatar answered Jun 18 '26 01:06

Liam Gretton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!