forked from dmitryilyin/haproxy-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8961176
commit 1461ed5
Showing
11 changed files
with
10,487 additions
and
10,492 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
\chapter{Configuring HAProxy} | ||
\section{Configuration file format} | ||
HAProxy's configuration process involves 3 major sources of parameters: | ||
|
||
\begin{enumerate} | ||
\item the arguments from the command-line, which always take precedence | ||
\item the "global" section, which sets process-wide parameters | ||
\item the proxies sections which can take form of "defaults", "listen", | ||
"frontend" and "backend". | ||
\end{enumerate} | ||
|
||
The configuration file syntax consists in lines beginning with a keyword | ||
referenced in this manual, optionally followed by one or several parameters | ||
delimited by spaces. If spaces have to be entered in strings, then they must be | ||
preceded by a backslash ('\textbackslash') to be escaped. Backslashes also have to be | ||
escaped by doubling them. | ||
|
||
\section{Time format} | ||
Some parameters involve values representing time, such as timeouts. These | ||
values are generally expressed in milliseconds (unless explicitly stated | ||
otherwise) but may be expressed in any other unit by suffixing the unit to the | ||
numeric value. It is important to consider this because it will not be repeated | ||
for every keyword. Supported units are: | ||
|
||
\begin{description} | ||
\item[us:] microseconds. 1 microsecond = 1/1000000 second | ||
\item[ms:] milliseconds. 1 millisecond = 1/1000 second. This is the default. | ||
\item[s:] seconds. 1s = 1000ms | ||
\item[m:] minutes. 1m = 60s = 60000ms | ||
\item[h:] hours. 1h = 60m = 3600s = 3600000ms | ||
\item[d:] days. 1d = 24h = 1440m = 86400s = 86400000ms | ||
\end{description} | ||
|
||
\section{Examples} | ||
\begin{verbatim} | ||
# Simple configuration for an HTTP proxy listening on port 80 on all | ||
# interfaces and forwarding requests to a single backend "servers" with a | ||
# single server "server1" listening on 127.0.0.1:8000 | ||
global | ||
daemon | ||
maxconn 256 | ||
defaults | ||
mode http | ||
timeout connect 5000ms | ||
timeout client 50000ms | ||
timeout server 50000ms | ||
frontend http-in | ||
bind *:80 | ||
default_backend servers | ||
backend servers | ||
server server1 127.0.0.1:8000 maxconn 32 | ||
# The same configuration defined with a single listen block. Shorter but | ||
# less expressive, especially in HTTP mode. | ||
global | ||
daemon | ||
maxconn 256 | ||
defaults | ||
mode http | ||
timeout connect 5000ms | ||
timeout client 50000ms | ||
timeout server 50000ms | ||
listen http-in | ||
bind *:80 | ||
server server1 127.0.0.1:8000 maxconn 32 | ||
\end{verbatim} | ||
|
||
Assuming haproxy is in \$PATH, test these configurations in a shell with: | ||
|
||
\verb|$ sudo haproxy -f configuration.conf -c| |
Oops, something went wrong.