SadServers
  • Scenarios
  • Labs
    All Labs Linux & Bash Web Servers Databases Data Processing Docker Kubernetes CI/CD Infrastructure as Code Tooling / Applications
  • Dashboard
  • Solutions
    For Individuals For Businesses
  • Ranking
  • Newsletter
  • Documentation
    FAQ Support Pro Accounts Pro+ Accounts Business Accounts Gift API CLI/TUI Privacy Troubleshooting Interviews
  • Blog
  • Pricing
  • Gift
    Gift Purchase Gift Redeem
  • About
Log In - Sign Up
  1. Labs
  2. HAProxy
  3. Cheatsheet

Guide

Concepts and learning path

Troubleshooting

Failure modes and fixes

Cheatsheet

Commands to keep handy

HAProxy cheatsheet

Service and config

CommandDescription
systemctl status haproxyService status
systemctl reload haproxyReload config (graceful)
haproxy -c -f /etc/haproxy/haproxy.cfgValidate config syntax
haproxy -vvVersion and build info

Stats and monitoring

Command / URLDescription
echo "show stat" | socat stdio /run/haproxy/admin.sockStats via socket
echo "show info" | socat stdio /run/haproxy/admin.sockRuntime info
http://host:8404/statsStats web UI (if enabled)
journalctl -u haproxy -fFollow service logs
ss -tlnp | grep haproxyCheck listeners

Runtime socket commands

To query the socket non-interactively from your terminal bash command line, pipe your command string straight into the socat network utility, for example: echo "show info" | sudo socat stdio unix-connect:/var/run/haproxy.sock

CommandDescription
show servers state <backend>Server UP/DOWN state
disable server <backend>/<server>Drain a server
enable server <backend>/<server>Re-enable a server
show errorsRecent HAProxy errors

Minimal HTTP load balancer

global log /dev/log local0 maxconn 4096 defaults log global mode http option httplog timeout connect 5s timeout client 50s timeout server 50s frontend http_front bind *:80 default_backend app_servers backend app_servers balance roundrobin option httpchk GET /health server app1 10.0.1.10:8080 check server app2 10.0.1.11:8080 check

ACL routing example

frontend http_front bind *:80 acl is_api path_beg /api use_backend api_servers if is_api default_backend web_servers

Pro tips

  • Always haproxy -c before reload — bad config can stop the daemon
  • Check the stats page first when backends show DOWN — health check path may be wrong
  • Use option forwardfor so backends see real client IPs
  • Drain servers with disable server before maintenance, then re-enable

Practice scenarios

Hands-on HAProxy scenarios on live Linux VMs: haproxy

SadServersSadServers

Real-world Linux and DevOps scenarios for hands-on learning and technical assessment.

Uptime Robot ratio (30 days)
Product
  • Scenarios
  • For Individuals
  • For Businesses
  • Pricing
Resources
  • FAQ
  • Blog
  • Newsletter
Company
  • About Us
  • Support
  • Privacy Policy
  • Terms of Service
  • Contact
Connect With Us
info@sadservers.com

Made in Canada 🇨🇦
Updated: 2026-06-13 16:06 UTC – 2d2950a