1HAPROXY(1) General Commands Manual HAPROXY(1)
2
3
4
6 HAProxy - fast and reliable http reverse proxy and load balancer
7
8
10 haproxy -f <configuration file> [-L <name>] [-n maxconn] [-N maxconn]
11 [-C <dir>] [-v|-vv] [-d] [-D] [-q] [-V] [-c] [-p <pidfile>] [-dk] [-ds]
12 [-de] [-dp] [-db] [-dM[<byte>]] [-m <megs>] [{-sf|-st} pidlist...]
13
14
16 HAProxy is a TCP/HTTP reverse proxy which is particularly suited for
17 high availability environments. Indeed, it can:
18 - route HTTP requests depending on statically assigned cookies ;
19 - spread the load among several servers while assuring server
20 persistence through the use of HTTP cookies ;
21 - switch to backup servers in the event a main one fails ;
22 - accept connections to special ports dedicated to service
23 monitoring ;
24 - stop accepting connections without breaking existing ones ;
25 - add/modify/delete HTTP headers both ways ;
26 - block requests matching a particular pattern ;
27 - hold clients to the right application server depending on
28 application cookies
29 - report detailed status as HTML pages to authenticated users from an
30 URI intercepted from the application.
31
32 It needs very little resource. Its event-driven architecture allows it
33 to easily handle thousands of simultaneous connections on hundreds of
34 instances without risking the system's stability.
35
36
38 -f <configuration file>
39 Specify configuration file path.
40
41
42 -L <name>
43 Set the local instance's peer name. Peers are defined in the
44 peers configuration section and used for syncing stick tables
45 between different instances. If this option is not specified,
46 the local hostname is used as peer name.
47
48
49 -n <maxconn>
50 Set the high limit for the total number of simultaneous connec‐
51 tions.
52
53
54 -N <maxconn>
55 Set the high limit for the per-listener number of simultaneous
56 connections.
57
58
59 -C <dir>
60 Change directory to <dir> before loading any files.
61
62
63 -v Display HAProxy's version.
64
65
66 -vv Display HAProxy's version and all build options.
67
68
69 -d Start in foreground with debugging mode enabled. When the proxy
70 runs in this mode, it dumps every connections, disconnections,
71 timestamps, and HTTP headers to stdout. This should NEVER be
72 used in an init script since it will prevent the system from
73 starting up.
74
75
76 -D Start in daemon mode.
77
78
79 -Ds Start in systemd daemon mode, keeping a process in foreground.
80
81
82 -q Disable messages on output.
83
84
85 -V Displays messages on output even when -q or 'quiet' are speci‐
86 fied. Some information about pollers and config file are dis‐
87 played during startup.
88
89
90 -c Only checks config file and exits with code 0 if no error was
91 found, or exits with code 1 if a syntax error was found.
92
93
94 -p <pidfile>
95 Ask the process to write down each of its children's pids to
96 this file in daemon mode.
97
98
99 -dk Disable use of kqueue(2). kqueue(2) is available only on BSD
100 systems.
101
102
103 -ds Disable use of speculative epoll(7). epoll(7) is available only
104 on Linux 2.6 and some custom Linux 2.4 systems.
105
106
107 -de Disable use of epoll(7). epoll(7) is available only on Linux 2.6
108 and some custom Linux 2.4 systems.
109
110
111 -dp Disables use of poll(2). select(2) might be used instead.
112
113
114 -dS Disables use of splice(2), which is broken on older kernels.
115
116
117 -db Disables background mode (stays in foreground, useful for debug‐
118 ging). For debugging, the '-db' option is very useful as it
119 temporarily disables daemon mode and multi-process mode. The
120 service can then be stopped by simply pressing Ctrl-C, without
121 having to edit the config nor run full debug.
122
123
124 -dM[<byte>]
125 Initializes all allocated memory areas with the given <byte>.
126 This makes it easier to detect bugs resulting from uninitialized
127 memory accesses, at the expense of touching all allocated memory
128 once. If <byte> is not specified, it defaults to 0x50 (ASCII
129 'P').
130
131
132 -m <megs>
133 Enforce a memory usage limit to a maximum of <megs> megabytes.
134
135
136 -sf <pidlist>
137 Send FINISH signal to the pids in pidlist after startup. The
138 processes which receive this signal will wait for all sessions
139 to finish before exiting. This option must be specified last,
140 followed by any number of PIDs. Technically speaking, SIGTTOU
141 and SIGUSR1 are sent.
142
143
144 -st <pidlist>
145 Send TERMINATE signal to the pids in pidlist after startup. The
146 processes which receive this signal will wait immediately termi‐
147 nate, closing all active sessions. This option must be specified
148 last, followed by any number of PIDs. Technically speaking,
149 SIGTTOU and SIGTERM are sent.
150
151
153 Since HAProxy can run inside a chroot, it cannot reliably access
154 /dev/log. For this reason, it uses the UDP protocol to send its logs
155 to the server, even if it is the local server. People who experience
156 trouble receiving logs should ensure that their syslog daemon listens
157 to the UDP socket. Several Linux distributions which ship with syslogd
158 from the sysklogd package have UDP disabled by default. The -r option
159 must be passed to the daemon in order to enable UDP.
160
161
163 Some signals have a special meaning for the haproxy daemon. Generally,
164 they are used between daemons and need not be used by the administra‐
165 tor.
166
167 - SIGUSR1
168 Tells the daemon to stop all proxies and exit once all sessions
169 are closed. It is often referred to as the "soft-stop" signal.
170
171 - SIGTTOU
172 Tells the daemon to stop listening to all sockets. Used inter‐
173 nally by -sf and -st.
174
175 - SIGTTIN
176 Tells the daemon to restart listening to all sockets after a
177 SIGTTOU. Used internally when there was a problem during hot
178 reconfiguration.
179
180 - SIGINT and SIGTERM
181 Both signals can be used to quickly stop the daemon.
182
183 - SIGHUP
184 Dumps the status of all proxies and servers into the logs.
185 Mostly used for trouble-shooting purposes.
186
187 - SIGQUIT
188 Dumps information about memory pools on stderr. Mostly used for
189 debugging purposes.
190
191 - SIGPIPE
192 This signal is intercepted and ignored on systems without
193 MSG_NOSIGNAL.
194
195
197 A much better documentation can be found in configuration.txt. On
198 Debian systems, you can find this file in /usr/share/doc/haproxy/con‐
199 figuration.txt.gz.
200
201
203 HAProxy was written by Willy Tarreau. This man page was written by
204 Arnaud Cornet and Willy Tarreau.
205
206
207
208
209 17 August 2007 HAPROXY(1)