← 返回命令列表

Linux command

haproxy 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start HAProxy

haproxy -f [/etc/haproxy/haproxy.cfg]

Check configuration

haproxy -c -f [/etc/haproxy/haproxy.cfg]

Reload configuration

haproxy -f [config.cfg] -sf $(pidof haproxy)

Start in daemon mode

haproxy -D -f [config.cfg]

Show version

haproxy -v

说明

HAProxy (High Availability Proxy) is a high-performance TCP/HTTP load balancer and reverse proxy that distributes incoming traffic across pools of backend servers. Its configuration is organized around frontends (which accept client connections on bound addresses and ports) and backends (which define the set of servers that handle requests, along with the balancing algorithm -- round-robin, least-connections, source-hash, and others). Active health checks continuously probe backend servers and automatically remove unhealthy nodes from rotation. Beyond basic load balancing, HAProxy provides SSL/TLS termination, HTTP header manipulation, content-based routing via ACLs, connection rate limiting, stick tables for session persistence, and a real-time statistics dashboard. It operates in an event-driven, single-process architecture that can handle hundreds of thousands of concurrent connections with low latency and minimal resource consumption, making it a standard choice for high-traffic production environments.

参数

-f _file_
Configuration file.
-c
Check configuration and exit.
-D
Daemon mode.
-sf _pids_
Soft-stop old processes.
-st _pids_
Hard-stop old processes.
-p _pidfile_
PID file path.
-n _maxconn_
Maximum connections.
-N _maxconn_
Default per-proxy maxconn.
-d
Debug mode.
-V
Verbose mode.

FAQ

What is the haproxy command used for?

HAProxy (High Availability Proxy) is a high-performance TCP/HTTP load balancer and reverse proxy that distributes incoming traffic across pools of backend servers. Its configuration is organized around frontends (which accept client connections on bound addresses and ports) and backends (which define the set of servers that handle requests, along with the balancing algorithm -- round-robin, least-connections, source-hash, and others). Active health checks continuously probe backend servers and automatically remove unhealthy nodes from rotation. Beyond basic load balancing, HAProxy provides SSL/TLS termination, HTTP header manipulation, content-based routing via ACLs, connection rate limiting, stick tables for session persistence, and a real-time statistics dashboard. It operates in an event-driven, single-process architecture that can handle hundreds of thousands of concurrent connections with low latency and minimal resource consumption, making it a standard choice for high-traffic production environments.

How do I run a basic haproxy example?

Run `haproxy -f [/etc/haproxy/haproxy.cfg]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -f _file_ do in haproxy?

Configuration file.