Index: docs/manual/mod/mod_proxy.xml
===================================================================
--- docs/manual/mod/mod_proxy.xml (revision 440792)
+++ docs/manual/mod/mod_proxy.xml (working copy)
@@ -578,6 +578,12 @@
generally 120ms), and thus prevent the firewall to drop the connection.
To enable keepalive set this property value to On.
+
| status |
- |
Single letter value defining the initial status of
- this worker: 'D' is disabled, 'S' is stopped
+ this worker: 'D' is disabled, 'S' is stopped, 'H' is hot-standby
and 'E' is in an error state. Status can be set (which is the default)
by prepending with '+' or cleared by prepending with '-'.
Thus, a setting of 'S-E' sets this worker to Stopped and
@@ -685,6 +691,22 @@
</Proxy>
+
+ Setting up a hot-standby, that will only be used if no other
+ members are available
+
+ ProxyPass / balancer://hotcluster/
+ <Proxy balancer://hotcluster>
+
+ BalancerMember http://1.2.3.4:8009 loadfactor=1
+ BalancerMember http://1.2.3.5:8009 loadfactor=2
+ # The below is the hot standby
+ BalancerMember http://1.2.3.6:8009 status=+H
+ ProxySet lbmethod=bytraffic
+
+ </Proxy>
+
+
When used inside a Location section, the first argument is omitted and the local
Index: CHANGES
===================================================================
--- CHANGES (revision 440792)
+++ CHANGES (working copy)
@@ -1,6 +1,10 @@
-*- coding: utf-8 -*-
Changes with Apache 2.2.4
+ *) mod_proxy_balancer: Workers can now be defined as part of
+ a balancer cluster "set" in which members of a lower-numbered set
+ are preferred over higher numbered ones. [Jim Jagielski]
+
*) mod_proxy_balancer: Workers can now be defined as "hot standby" which
will only be used if all other workers are unusable (eg: in
error or disabled). Also, the balancer-manager displays the election
Index: modules/proxy/mod_proxy_balancer.c
===================================================================
--- modules/proxy/mod_proxy_balancer.c (revision 440792)
+++ modules/proxy/mod_proxy_balancer.c (working copy)
@@ -93,6 +93,7 @@
/* Set to the original configuration */
workers[i].s->lbstatus = workers[i].s->lbfactor =
(workers[i].lbfactor ? workers[i].lbfactor : 1);
+ workers[i].s->lbset = workers[i].lbset;
}
/* Set default number of attempts to the number of
* workers.
@@ -172,10 +173,12 @@
const char *route, request_rec *r)
{
int i;
- int checking_standby = 0;
- int checked_standby = 0;
+ int checking_standby;
+ int checked_standby;
proxy_worker *worker;
+
+ checking_standby = checked_standby = 0;
while (!checked_standby) {
worker = (proxy_worker *)balancer->workers->elts;
for (i = 0; i < balancer->workers->nelts; i++, worker++) {
@@ -601,6 +604,12 @@
else if (!strcasecmp(val, "Enable"))
wsel->s->status &= ~PROXY_WORKER_DISABLED;
}
+ if ((val = apr_table_get(params, "ls"))) {
+ int ival = atoi(val);
+ if (ival >= 0 && ival <= 99) {
+ wsel->s->lbset = ival;
+ }
+ }
}
if (apr_table_get(params, "xml")) {
@@ -663,13 +672,13 @@
ap_rputs("\n\n "
"| Worker URL | "
"Route | RouteRedir | "
- "Factor | Status | "
+ "Factor | Set | Status | "
"Elected | To | From | "
" \n", r);
worker = (proxy_worker *)balancer->workers->elts;
for (n = 0; n < balancer->workers->nelts; n++) {
-
+ char fbuf[50];
ap_rvputs(r, "\n| uri, "?b=",
balancer->name + sizeof("balancer://") - 1, "&w=",
ap_escape_uri(r->pool, worker->name),
@@ -677,7 +686,8 @@
ap_rvputs(r, worker->name, " | ", NULL);
ap_rvputs(r, "", worker->s->route, NULL);
ap_rvputs(r, " | ", worker->s->redirect, NULL);
- ap_rprintf(r, " | %d | ", worker->s->lbfactor);
+ ap_rprintf(r, " | %d | ", worker->s->lbfactor);
+ ap_rprintf(r, "%d | ", worker->s->lbset);
if (worker->s->status & PROXY_WORKER_DISABLED)
ap_rputs("Dis ", r);
if (worker->s->status & PROXY_WORKER_IN_ERROR)
@@ -691,10 +701,11 @@
if (!PROXY_WORKER_IS_INITIALIZED(worker))
ap_rputs("-", r);
ap_rputs(" | ", r);
- ap_rprintf(r, "%" APR_SIZE_T_FMT " | ", worker->s->elected);
- ap_rprintf(r, "%" APR_OFF_T_FMT " | ", worker->s->transferred);
- ap_rprintf(r, "%" APR_OFF_T_FMT " | ", worker->s->read);
- ap_rputs(" \n", r);
+ ap_rprintf(r, "%" APR_SIZE_T_FMT " | ", worker->s->elected);
+ ap_rputs(apr_strfsize(worker->s->transferred, fbuf), r);
+ ap_rputs(" | ", r);
+ ap_rputs(apr_strfsize(worker->s->read, fbuf), r);
+ ap_rputs(" | \n", r);
++worker;
}
@@ -708,20 +719,22 @@
ap_rvputs(r, "
|