Last active
December 12, 2015 07:18
-
-
Save huberflores/4735576 to your computer and use it in GitHub Desktop.
Installation and Configuration of HAProxy
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
/* | |
* author Huber Flores | |
*/ | |
# Download latest version of HAProxy from http://haproxy.1wt.eu/#down | |
# version downloaded for this tutorial | |
# haproxy-1.4.15.tar.gz (wget http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.15.tar.gz) | |
$ tar -xvf haproxy-1.4.15.tar.gz | |
# Compile HAProxy | |
$ make TARGET=linux26 ARCH=native | |
# "haproxy" file is created | |
# Move to your preferable location | |
$ cp haproxy /usr/local/sbin ///usr/local/sbin is usually in $PATH, so haproxy will then be easy to run simply by typing "haproxy". | |
# haproxy.conf | |
# Create a configuration file in /etc/haproxy/haproxy.conf | |
$ nano /etc/haproxy/haproxy.conf | |
global | |
maxconn 4096 | |
pidfile /var/run/haproxy.pid | |
daemon | |
defaults | |
mode http | |
retries 3 | |
option redispatch | |
maxconn 2000 | |
contimeout 5000 | |
clitimeout 50000 | |
srvtimeout 50000 | |
listen DRAGONFLY 172.xxx.xxx.xxx:80 | |
mode http | |
cookie DRAGONFLY insert | |
balance roundrobin | |
option httpclose | |
option forwardfor | |
stats enable | |
stats auth myuser:mypass | |
server Server1 172.xxx.xxx.xxx:8080 cookie DRAGONFLY_Server_01 check | |
server Server2 172.xxx.xxx.xxx:8080 cookie DRAGONFLY_Server_02 check | |
server ServerN 172.xxx.xxx.xxx:8080 cookie DRAGONFLY_Server_N check | |
Start HAProxy | |
haproxy -f /etc/haproxy/haproxy.conf | |
Statistics about HAProxy | |
http://yourserver/haproxy?stats | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment