1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5 This file is generated from xml source: DO NOT EDIT
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
8 <title>mod_proxy_balancer - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
14 <div id="page-header">
15 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
16 <p class="apache">Apache HTTP Server Version 2.3</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
20 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.3</a> > <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Module mod_proxy_balancer</h1>
24 <p><span>Available Languages: </span><a href="../en/mod/mod_proxy_balancer.html" title="English"> en </a> |
25 <a href="../ja/mod/mod_proxy_balancer.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a></p>
27 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td><code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> extension for load balancing </td></tr>
28 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
29 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>proxy_balancer_module</td></tr>
30 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_proxy_balancer.c</td></tr>
31 <tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.1 and later</td></tr></table>
34 <p>This module <em>requires</em> the service of <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>. It provides load balancing support for
35 <code>HTTP</code>, <code>FTP</code> and <code>AJP13</code> protocols
38 <p>Load balancing scheduler algorithm is provided by not this
39 module but other modules such as:
40 <code class="module"><a href="../mod/mod_lbmethod_byrequests.html">mod_lbmethod_byrequests</a></code>,
41 <code class="module"><a href="../mod/mod_lbmethod_bytraffic.html">mod_lbmethod_bytraffic</a></code> and
42 <code class="module"><a href="../mod/mod_lbmethod_bybusyness.html">mod_lbmethod_bybusyness</a></code>.
45 <p>Thus, in order to get the ability of load balancing,
46 <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>, <code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code>
47 and at least one of load balancing scheduler algorithm modules have
48 to be present in the server.</p>
50 <div class="warning"><h3>Warning</h3>
51 <p>Do not enable proxying until you have <a href="mod_proxy.html#access">secured your server</a>. Open proxy
52 servers are dangerous both to your network and to the Internet at
56 <div id="quickview"><h3 class="directives">Directives</h3>
57 <p>This module provides no
61 <li><img alt="" src="../images/down.gif" /> <a href="#scheduler">Load balancer scheduler algorithm</a></li>
62 <li><img alt="" src="../images/down.gif" /> <a href="#example">Example of a balancer configuration</a></li>
63 <li><img alt="" src="../images/down.gif" /> <a href="#environment">Exported Environment Variables</a></li>
64 <li><img alt="" src="../images/down.gif" /> <a href="#enable">Enabling Balancer Manager Support</a></li>
65 </ul><h3>See also</h3>
67 <li><code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code></li>
69 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
71 <h2><a name="scheduler" id="scheduler">Load balancer scheduler algorithm</a></h2>
73 <p>At present, there are 3 load balancer scheduler algorithms available
74 for use: Request Counting, Weighted Traffic Counting and Pending Request
75 Counting. These are controlled via the <code>lbmethod</code> value of
76 the Balancer definition. See the <code class="directive"><a href="../mod/mod_proxy.html#proxypass">ProxyPass</a></code>
77 directive for more information.</p>
79 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
81 <h2><a name="example" id="example">Example of a balancer configuration</a></h2>
83 <p>Before we dive into the technical details, here's an example of
84 how you might use <code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code> to provide
85 load balancing between two back-end servers:
88 <div class="example"><p><code>
89 <Proxy balancer://mycluster><br />
90 BalancerMember http://192.168.1.50:80<br />
91 BalancerMember http://192.168.1.51:80<br />
93 ProxyPass /test balancer://mycluster/
95 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
97 <h2><a name="environment" id="environment">Exported Environment Variables</a></h2>
99 <p>At present there are 6 environment variables exported:</p>
103 <dt><var><a name="balancer_session_sticky" id="balancer_session_sticky">BALANCER_SESSION_STICKY</a></var></dt>
105 <p>This is assigned the <var>stickysession</var> value used in the current
106 request. It is the cookie or parameter name used for sticky sessions</p>
110 <dt><var><a name="balancer_session_route" id="balancer_session_route">BALANCER_SESSION_ROUTE</a></var></dt>
112 <p>This is assigned the <var>route</var> parsed from the current
117 <dt><var><a name="balancer_name" id="balancer_name">BALANCER_NAME</a></var></dt>
119 <p>This is assigned the name of the balancer used for the current
120 request. The value is something like <code>balancer://foo</code>.</p>
124 <dt><var><a name="balancer_worker_name" id="balancer_worker_name">BALANCER_WORKER_NAME</a></var></dt>
126 <p>This is assigned the name of the worker used for the current request.
127 The value is something like <code>http://hostA:1234</code>.</p>
131 <dt><var><a name="balancer_worker_route" id="balancer_worker_route">BALANCER_WORKER_ROUTE</a></var></dt>
133 <p>This is assigned the <var>route</var> of the worker that will be
134 used for the current request.</p>
138 <dt><var><a name="balancer_route_changed" id="balancer_route_changed">BALANCER_ROUTE_CHANGED</a></var></dt>
140 <p>This is set to 1 if the session route does not match the
141 worker route (BALANCER_SESSION_ROUTE != BALANCER_WORKER_ROUTE) or the
142 session does not yet have an established route. This can be used to
143 determine when/if the client needs to be sent an updated route
144 when sticky sessions are used.</p>
148 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
149 <div class="section">
150 <h2><a name="enable" id="enable">Enabling Balancer Manager Support</a></h2>
152 <p>This module <em>requires</em> the service of
153 <code class="module"><a href="../mod/mod_status.html">mod_status</a></code>.
154 Balancer manager enables dynamic update of balancer
155 members. You can use balancer manager to change the balance
156 factor or a particular member, or put it in the off line
160 <p>Thus, in order to get the ability of load balancer management,
161 <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> and <code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code>
162 have to be present in the server.</p>
164 <p>To enable load balancer management for browsers from the example.com
165 domain add this code to your <code>httpd.conf</code>
166 configuration file</p>
167 <div class="example"><p><code>
168 <Location /balancer-manager><br />
169 SetHandler balancer-manager<br />
171 Order Deny,Allow<br />
173 Allow from .example.com<br />
177 <p>You can now access load balancer manager by using a Web browser
179 <code>http://your.server.name/balancer-manager</code></p>
182 <div class="bottomlang">
183 <p><span>Available Languages: </span><a href="../en/mod/mod_proxy_balancer.html" title="English"> en </a> |
184 <a href="../ja/mod/mod_proxy_balancer.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a></p>
185 </div><div id="footer">
186 <p class="apache">Copyright 2008 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
187 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>