Commands Cheat Sheet

Evaluating engineering tools? Get the comparison in Google Sheets

(Perfect for making buy/build decisions or internal reviews.)

Most-used commands
Your email is safe thing.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

Connection

haproxy -f /path/to/haproxy.cfg
Start HAProxy with a specific configuration file

haproxy -c -f /path/to/haproxy.cfg
Check the configuration file for errors without starting

socat stdio unix:/var/run/haproxy.sock
Connect to HAProxy's runtime socket

Status and Stats

echo 'show info' | socat stdio unix:/var/run/haproxy.sock
Display HAProxy instance information

echo 'show stat' | socat stdio unix:/var/run/haproxy.sock
Display statistics for all proxies

echo 'show stat -1 4 -1' | socat stdio unix:/var/run/haproxy.sock
Show stats in CSV format (field 4 is status)

curl http://localhost:8404/stats
Access the stats page (if stats page is enabled)

Server Management

echo 'disable server backend_name/server_name' | socat stdio unix:/var/run/haproxy.sock
Disable a server

echo 'enable server backend_name/server_name' | socat stdio unix:/var/run/haproxy.sock
Enable a server

echo 'set server backend_name/server_name weight 10' | socat stdio unix:/var/run/haproxy.sock
Change server weight

echo 'set server backend_name/server_name state ready' | socat stdio unix:/var/run/haproxy.sock
Force server state

Backend Management

echo 'show backends' | socat stdio unix:/var/run/haproxy.sock
List all backends

echo 'set maxconn server backend_name/server_name 100' | socat stdio unix:/var/run/haproxy.sock
Set max connections

echo 'show servers state backend_name' | socat stdio unix:/var/run/haproxy.sock
Show server states in backend

Sessions and Connections

echo 'show sess' | socat stdio unix:/var/run/haproxy.sock
List current sessions

echo 'show conn' | socat stdio unix:/var/run/haproxy.sock
List connections

echo 'shutdown session id' | socat stdio unix:/var/run/haproxy.sock
Terminate a specific session

Health Checks

echo 'disable health backend_name/server_name' | socat stdio unix:/var/run/haproxy.sock
Disable health checks for a server

echo 'enable health backend_name/server_name' | socat stdio unix:/var/run/haproxy.sock
Enable health checks for a server

Runtime Operations

echo 'reload' | socat stdio unix:/var/run/haproxy.sock
Reload HAProxy configuration (if master-worker mode is enabled)

echo 'clear counters' | socat stdio unix:/var/run/haproxy.sock
Clear max connection counters

systemctl reload haproxy
Reload HAProxy service (using systemd)

service haproxy reload
Reload HAProxy service (using SysV init)