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