<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Last Engine &#187; haproxy</title>
	<atom:link href="http://www.lastengine.com/tag/haproxy/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lastengine.com</link>
	<description>Making Voice 2.0 Work</description>
	<lastBuildDate>Wed, 26 May 2010 01:40:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Installing haproxy load balancing for http and https</title>
		<link>http://www.lastengine.com/99/installing-haproxy-load-balancing-for-http-and-https/</link>
		<comments>http://www.lastengine.com/99/installing-haproxy-load-balancing-for-http-and-https/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 18:58:59 +0000</pubDate>
		<dc:creator>Vijesh</dc:creator>
				<category><![CDATA[Developers]]></category>
		<category><![CDATA[haproxy]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[load balancing]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.lastengine.com/?p=99</guid>
		<description><![CDATA[This example will guide you through a simple IP based load balancing solution that handles ssl traffic.
The Configuration =

Load Balancer:    // will be our haproxy server
Web Server 1:   // web application server 1
Web Server 2:   // web application server 2
Admin Panel Port 8080:   // Statistics Panel [...]]]></description>
			<content:encoded><![CDATA[<p>This example will guide you through a simple IP based load balancing solution that handles ssl traffic.</p>
<p>The Configuration =</p>
<ul>
<li>Load Balancer:  <192.168.0.2>  // will be our haproxy server</li>
<li>Web Server 1: <192.168.0.10>  // web application server 1</li>
<li>Web Server 2: <192.168.0.20>  // web application server 2</li>
<li>Admin Panel Port 8080: <192.168.0.2>  // Statistics Panel on port 8080</li>
</ul>
<blockquote><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Web Server 1<br />
Load Balancer   <<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Web Server 2</p></blockquote>
<h3>Step 1: Get and Install haproxy</h3>
<p>We&#8217;ll be using the 1.3.17 src files to install haproxy. You can get them from <a href="http://haproxy.1wt.eu/">http://haproxy.1wt.eu/</a></p>
<pre class="brush:bash">wget http://haproxy.1wt.eu/download/1.3/src/haproxy-1.3.17.tar.gz 

cd haproxy-1.3.17 

make TARGET=linux26 

cp /path/to/haproxy-1.3.17/examples/haproxy.init /etc/init.d/haproxy 

chmod +x /etc/init.d/haproxy</pre>
<h3>Step 2: Create some users for security</h3>
<p>We&#8217;re going to add a haproxy user and run it in a chroot jail. Be sure to read up on other security measures for your server.</p>
<pre class="brush:bash">useradd haproxy 

mkdir /var/chroot/haproxy 

chown haproxy:haproxy /var/chroot/haproxy 

chmod 700 /var/chroot/haproxy</pre>
<h3>Step 3: Configure /etc/haproxy.cfg</h3>
<p>This will be a simple load balancing. The HAProxy server will listen to 1 IP and distribute to 2 servers.</p>
<pre class="brush:plain">global
maxconn	 10000 # Total Max Connections.
log	 127.0.0.1	local0
log	 127.0.0.1	local1 notice
daemon
nbproc	 1 # Number of processes
user	 haproxy
    	group	 haproxy
    	chroot	 /var/chroot/haproxy

defaults
log	 global
option tcplog
mode	 tcp
clitimeout	60000
srvtimeout	30000
contimeout	4000
retries	 3
redispatch
option	 httpclose 

listen	load_balanced	192.168.0.2:80,192.168.0.2:443
balance	 source
option	 ssl-hello-chk
option	 forwardfor

server webserver1 192.168.0.10 weight 1 maxconn 5000 check
server webserver2 192.168.0.20 weight 1 maxconn 5000 check

listen  admin_stats 192.168.0.2:8080
mode	 http
stats uri	/my_stats
stats realm 	Global\ statistics
stats auth 	username:password</pre>
<p>Start up HAProxy by /etc/init.d/haproxy start.</p>
<h3>Step 4: Configuring logging</h3>
<p>Edit /etc/sysconfig/syslog</p>
<pre class="brush:plain">SYSLOGD_OPTIONS=”-m 0 -r”</pre>
<p>Edit /etc/syslog.conf. Add the following:</p>
<pre class="brush:plain">local0.* /var/log/haproxy.log
local1.* /var/log/haproxy-1.log</pre>
<p>Restart Syslog</p>
<pre class="brush:bash">service syslog restart</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.lastengine.com/99/installing-haproxy-load-balancing-for-http-and-https/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>
