Skip to content

Commit

Permalink
Split chapters and finish chapter03
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryilyin committed Jul 5, 2012
1 parent 8961176 commit 1461ed5
Show file tree
Hide file tree
Showing 11 changed files with 10,487 additions and 10,492 deletions.
378 changes: 378 additions & 0 deletions chapter01.tex

Large diffs are not rendered by default.

76 changes: 76 additions & 0 deletions chapter02.tex
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|
Loading

0 comments on commit 1461ed5

Please sign in to comment.