linode / docs

Linode guides and tutorials.
https://www.linode.com/docs/
1.38k stars 1.22k forks source link

Using HAProxy for Load Balancing Proposed Changes #7126

Closed Rajakavitha1 closed 1 month ago

Rajakavitha1 commented 1 month ago

Link: https://www.linode.com/docs/guides/how-to-use-haproxy-for-load-balancing/

Issue

With HAProxy 2.8.5, the suggested configuration fails on startup with:

'option httpchk' : hiding headers or body at the end of the version string is unsupported.Use 'http-check send' directive instead.

It seems like with this version, the proper replacement for:

option httpchk HEAD / HTTP/1.1\r\nHost:localhost

is:

option httpchk HEAD / HTTP/1.1 http-check send hdr host localhost

Suggested Fix

Rajakavitha1 commented 1 month ago

Validated the steps and the instructions in the guide are accurate.

[sudo] password for rajie: 
rajie@haproxy:~$ sudo haproxy restart
HAProxy version 2.8.5-1ubuntu3 2024/04/01 - https://haproxy.org/
Status: long-term supported branch - will stop receiving fixes around Q2 2028.
Known bugs: http://www.haproxy.org/bugs/bugs-2.8.5.html
Running on: Linux 6.8.0-41-generic #41-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug  2 20:41:06 UTC 2024 x86_64
Usage : haproxy [-f <cfgfile|cfgdir>]* [ -vdVD ] [ -n <maxconn> ] [ -N <maxpconn> ]
        [ -p <pidfile> ] [ -m <max megs> ] [ -C <dir> ] [-- <cfgfile>*]
        -v displays version ; -vv shows known build options.
        -d enters debug mode ; -db only disables background mode.
        -dM[<byte>,help,...] debug memory (default: poison with <byte>/0x50)
        -V enters verbose mode (disables quiet mode)
        -D goes daemon ; -C changes to <dir> before loading files.
        -W master-worker mode.
        -Ws master-worker mode with systemd notify support.
        -q quiet mode : don't display messages
        -c check mode : only check config files and exit
        -cc check condition : evaluate a condition and exit
        -n sets the maximum total # of connections (uses ulimit -n)
        -m limits the usable amount of memory (in MB)
        -N sets the default, per-proxy maximum # of connections (0)
        -L set local peer name (default to hostname)
        -p writes pids of all children to this file
        -dC[[key],line] display the configuration file, if there is a key, the file will be anonymised
        -de disables epoll() usage even when available
        -dp disables poll() usage even when available
        -dS disables splice usage (broken on old kernels)
        -dG disables getaddrinfo() usage
        -dR disables SO_REUSEPORT usage
        -dL dumps loaded object files after config checks
        -dK{class[,...]} dump registered keywords (use 'help' for list)
        -dr ignores server address resolution failures
        -dV disables SSL verify on servers side
        -dW fails if any warning is emitted
        -dD diagnostic mode : warn about suspicious configuration statements
        -dF disable fast-forward
        -sf/-st [pid ]* finishes/terminates old pids.
        -x <unix_socket> get listening sockets from a unix socket
        -S <bind>[,<bind options>...] new master CLI

rajie@haproxy:~$ sudo systemctl status haproxy
● haproxy.service - HAProxy Load Balancer
     Loaded: loaded (/usr/lib/systemd/system/haproxy.service; enabled; preset: enabled)
     Active: active (running) since Fri 2024-10-25 18:48:52 IST; 24min ago
       Docs: man:haproxy(1)
             file:/usr/share/doc/haproxy/configuration.txt.gz
   Main PID: 18145 (haproxy)
     Status: "Ready."
      Tasks: 3 (limit: 4614)
     Memory: 39.2M (peak: 39.5M)
        CPU: 83ms
     CGroup: /system.slice/haproxy.service
             ├─18145 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -S /run/haproxy-master.so>
             └─18147 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -S /run/haproxy-master.so>

Oct 25 18:48:52 haproxy systemd[1]: Starting haproxy.service - HAProxy Load Balancer...
Oct 25 18:48:52 haproxy haproxy[18145]: [NOTICE]   (18145) : New worker (18147) forked
Oct 25 18:48:52 haproxy haproxy[18145]: [NOTICE]   (18145) : Loading success.
Oct 25 18:48:52 haproxy systemd[1]: Started haproxy.service - HAProxy Load Balancer.
lines 1-18/18 (END)